1. Write a C program to find the depth or height of a binary tree.
2. Write a C program to determine the number of elements (or size) in a binary tree.
3. Write a C program to delete a tree (i.e, free up its nodes)
4. Write a C program to find the minimum value in a binary search tree.
5. Write a C program to create a mirror copy of a tree (left nodes become right and right nodes become left)
6. Write C code to implement the preorder(), inorder() and postorder() traversals. Whats their time complexities?
7. Write a C program to create a copy of a tree
8. Write a C program to check if a given binary tree is a binary search tree or not?
9. Write a C program to implement level order traversal of a tree.
Solution:Breadth First Search of the tree gives the level order traversal.
10. Write a C program to delete a node from a Binary Search Tree?
11. Write a C program to search for a value in a binary search tree (BST).
12. Write a C program to count the number of leaves in a tree
13. Write a C program for iterative preorder, inorder and postorder tree traversals
Solution:Use stacks to depict the function calls.Not much different from routine traversals.
2. Write a C program to determine the number of elements (or size) in a binary tree.
3. Write a C program to delete a tree (i.e, free up its nodes)
4. Write a C program to find the minimum value in a binary search tree.
5. Write a C program to create a mirror copy of a tree (left nodes become right and right nodes become left)
6. Write C code to implement the preorder(), inorder() and postorder() traversals. Whats their time complexities?
7. Write a C program to create a copy of a tree
8. Write a C program to check if a given binary tree is a binary search tree or not?
9. Write a C program to implement level order traversal of a tree.
Solution:Breadth First Search of the tree gives the level order traversal.
10. Write a C program to delete a node from a Binary Search Tree?
11. Write a C program to search for a value in a binary search tree (BST).
12. Write a C program to count the number of leaves in a tree
13. Write a C program for iterative preorder, inorder and postorder tree traversals
Solution:Use stacks to depict the function calls.Not much different from routine traversals.
No comments:
Post a Comment