Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int ShowTree(TREE *root, int N)
- {
- size_t level = 0, res = 0;
- q = NULL;
- TREE *t;
- TREE *z;
- t = NULL;
- Put(root);
- Put(t);
- while (!Empty(q))
- {
- t = Get();
- if (t == NULL)
- {
- level++;
- Put(NULL);
- if (level == N)
- break;
- }
- else
- {
- if (t->left != NULL)
- Put(t->left);
- if (t->right != NULL)
- Put(t->right);
- printf("%d ", t->inf);
- }
- }
- while (!Empty(q))
- {
- z = Get();
- res = res + 1;
- }
- return res;
- puts("");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement