https://sweetdev.tistory.com/120 불러오는 중입니다... 이 글에서 '스택 없이 트리를 traverse 하는 법에 threaded binary tree를 쓰는 방법'이 있다고 했는데, 오늘은 그 방법에 대해서 다뤄보려고 한다. binary tree에서는 inorder traverse 하기 위해서 스택을 썼었다. (이제 혼자서도 잘짜요!..ㅎㅎ) 그럼, threaded binary tree에서는 어떻게 구현할까?? 이렇게 구현하면 된다고 한다.
쓰레드라는 표현을 굉장히 자주 들었는데 뭔지는 몰랐었다. 여기서 살펴보고자 한다! binary tree의 링크 표현을 보면, 실제 표현보다 더 많은 null link가 있다고 한다. 이진 트리에는 총 2n개의 링크 중에 n+1개의 null link가 있으니까, 과반수 이상이 놀고있는 링크인 것이다. 이것을 안타까워한 어떤 공머생이, null link를 Thread라는, 다른 노드를 가리키는 포인터로 대치하였다고 한다. 규칙은 다음과 같다 (1) ptr-> leftChild가 null이면, ptr-> leftChild를 inorder traverse 할 때, ptr 앞에 방문하는 노드에 대한 포인터로 대치한다. 이것은 null link를 ptr의 inorder predecessor에 대한 포인터로 대치하는..
for (int i=0; i
Delegate채택을 위해서 In this case, the output of the session is set to an AVCaptureMetaDataOutput object. The AVCaptureMetaDataOutput class is the core part of QR code reading. This class, in combination with the AVCaptureMetadataOutputObjectsDelegate protocol, is used to intercept any metadata found in the input device (the QR code captured by the device's camera) and translate it to a human-readabl..
이것도 이산수학에서 배운 내용이긴 한데, 기억이 가물가물하고 그때는 벼락치기 했으니까 다시 정리해볼게요!! Preorder Traversal Inorder Traversal Postorder Traversal 그리고 Levelorder Traversal 이케 세가지를 배울거라고 합니다 Preorder: 이름처럼, 자기 자신(root)-left-right Inorder: left-root-right Postorder: left-right-root 이렇게 생긴 바이너리 트리가 있다고 해 봅시다! 얘를 preorder, inorder, postorder로 traverse 해보아용 preorder: A-B-D-H-E-C-F-I-G-J-L-K inorder: D-H-B-E-A-I-F-C-L-J-G-K postor..