### Job Interview Questions on Trees

1. Write a C program to find the depth or height of a tree.

2. Write a C program to determine the number of elements (or size) in a tree.

3. Write a C program to delete a tree (i.e, free up its nodes)

4. Write C code to determine if two trees are identical

5. Write a C program to find the minimum value in a binary search tree.

6. Write a C program to compute the maximum depth in a tree?

7. Write a C program to create a mirror copy of a tree (left nodes become right and right nodes become left)!

8. Write C code to return a pointer to the nth node of an inorder traversal of a BST.

9. Write C code to implement the preorder(), inorder() and postorder() traversals. Whats their time complexities?

10. Write a C program to create a copy of a tree

11. Write C code to check if a given binary tree is a binary search tree or not?

12. Write C code to implement level order traversal of a tree.

13. Write a C program to delete a node from a Binary Search Tree?

14. Write C code to search for a value in a binary search tree (BST).

15. Write C code to count the number of leaves in a tree

16. Write C code for iterative preorder, inorder and postorder tree traversals

17. Can you construct a tree using postorder and preorder traversal?

18. Construct a tree given its inorder and preorder traversal strings. Similarly construct a tree given its inorder and post order traversal strings.

19. Find the closest ancestor of two nodes in a tree.

20. Given an expression tree, evaluate the expression and obtain a paranthesized form of the expression.

21. How do you convert a tree into an array?

22. What is an AVL tree?

23. How many different trees can be constructed using n nodes?

24. A full N-ary tree has M non-leaf nodes, how many leaf nodes does it have?

25. Implement Breadth First Search (BFS) and Depth First Search (DFS)

26. Write pseudocode to add a new node to a Binary Search Tree (BST)

27. What is a threaded binary tree?

#### 1 comment:

1. Tks very much for your post.

Avoid surprises — interviews need preparation. Some questions come up time and time again — usually about you, your experience and the job itself. We've gathered together the most common questions so you can get your preparation off to a flying start.

You also find all interview questions at link at the end of this post.

Source: Download Ebook: Ultimate Guide To Job Interview Questions Answers:

Best rgs