Job Interview Questions on Trees
- Write a C program to find the depth or height of a tree.
- Write a C program to determine the number of elements (or size) in a tree.
- Write a C program to delete a tree (i.e, free up its nodes)
- Write C code to determine if two trees are identical
- Write a C program to find the minimum value in a binary search tree.
- Write a C program to compute the maximum depth in a tree?
- Write a C program to create a mirror copy of a tree (left nodes become right and right nodes become left)!
- Write C code to return a pointer to the nth node of an inorder traversal of a BST.
- Write C code to implement the preorder(), inorder() and postorder() traversals. Whats their time complexities?
- Write a C program to create a copy of a tree
- Write C code to check if a given binary tree is a binary search tree or not?
- Write C code to implement level order traversal of a tree.
- Write a C program to delete a node from a Binary Search Tree?
- Write C code to search for a value in a binary search tree (BST).
- Write C code to count the number of leaves in a tree
- Write C code for iterative preorder, inorder and postorder tree traversals
- Can you construct a tree using postorder and preorder traversal?
- Construct a tree given its inorder and preorder traversal strings. Similarly construct a tree given its inorder and post order traversal strings.
- Find the closest ancestor of two nodes in a tree.
- Given an expression tree, evaluate the expression and obtain a paranthesized form of the expression.
- How do you convert a tree into an array?
- What is an AVL tree?
- How many different trees can be constructed using n nodes?
- A full N-ary tree has M non-leaf nodes, how many leaf nodes does it have?
- Implement Breadth First Search (BFS) and Depth First Search (DFS)
- Write pseudocode to add a new node to a Binary Search Tree (BST)
- What is a threaded binary tree?