165. 구조체 트리 후위 순회의 k번째 노드
다음 C 프로그램의 실행 결과를 쓰시오.
1#include <stdio.h>23struct Node {4int val;5struct Node *left;6struct Node *right;7};89int cnt = 0;10int found = -1;1112void post(struct Node *n, int k) {13if (n == NULL) return;14post(n->left, k);15post(n->right, k);16cnt++;17if (cnt == k) found = n->val;18}1920int main() {21struct Node d = {4, NULL, NULL};22struct Node e = {9, NULL, NULL};23struct Node b = {2, &d, NULL};24struct Node c = {7, NULL, &e};25struct Node a = {5, &b, &c};26post(&a, 3);27printf("%d %d\n", found, cnt);28return 0;29}