Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //كدة هيخلي الطباعة أحسن شوية
- void print_preorder(node_id* tree,int c)
- {
- if (tree && tree->id != ~(1<<31))
- {
- int i; for(i=0;i<c;i++) printf("\t");
- printf("%d %s\n", tree->id, tree->name);
- print_preorder(tree->left,c+1);
- print_preorder(tree->right,c+1);
- }
- else
- printf("\n");
- }
- void print_inorder(node_id* tree,int c)
- {
- if (tree && tree->id != ~(1<<31))
- {
- print_inorder(tree->left,c+1);
- int i;
- for(i=0; i<c; i++) printf("\t");
- printf("%d %s\n", tree->id, tree->name);
- print_inorder(tree->right,c+1);
- }
- else
- printf("\n");
- }
- void print_postorder(node_id* tree, int c)
- {
- if (tree && tree->id != ~(1<<31))
- {
- print_postorder(tree->left,c+1);
- print_postorder(tree->right,c+1);
- int i; for(i=0;i<c;i++) printf("\t");
- printf("%d s\n", tree->id, tree->name);
- }
- else
- printf("\n");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement