Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Masfiq
- * 25 march, 2017
- */
- //Node is defined as
- struct node
- {
- int data;
- node* left;
- node* right;
- };
- */
- void inOrder(node *root) {
- if(root->left != 0)
- inOrder(root->left);
- printf("%d ", root->data);
- if(root->right != 0)
- inOrder(root->right);
- }
- void preOrder(node *root) {
- printf("%d ", root->data);
- if(root->left != 0)
- preOrder(root->left);
- if(root->right != 0)
- preOrder(root->right);
- }
- void postOrder(node *root) {
- if(root->left != 0)
- postOrder(root->left);
- if(root->right != 0)
- postOrder(root->right);
- printf("%d ", root->data);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement