Last active
December 14, 2021 02:38
-
-
Save atoye1/d3deaa4d9a5291bd5be429d566d858f3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct node{ | |
struct node* left; | |
struct node* right; | |
int data; | |
} | |
struct node *tree_ptr; | |
void preorder(struct node* tree_ptr){ | |
if (tree_ptr) { | |
printf("%d", tree_ptr->data); | |
preorder(tree_ptr->left); | |
preorder(tree_ptr->right); | |
} | |
} | |
// 중위 후위순회는 printf()의 위치를 변경함으로써 구현가능하다 | |
// 단말노드의 left right 는 NULL | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment