Data Structure interview questions


36. What is Tree traversal algorithm ?
Tree traversal is the process of visiting each node in a tree, such as a binary tree or binary search tree, exactly once. There are several effective traversal algorithms which we will cover below.

37. What are the tasks performed during preorder traversal ?
A pre-order traversal on a tree performs the following steps starting from the root:

Return the root node value.
Traverse the left subtree by recursively calling the pre-order function.
Traverse the right subtree by recursively calling the pre-order function.

38. What are the different binary tree traversal techniques ?
Preorder traversal
Inorder traversal
Postorder traversal

39. Properties of Binary Tree ?
Trees are used to represent data in hierarchical form.
Binary tree is the one in which each node has maximum of two child- node.
The order of binary tree is ‘2’.
Binary tree does not allow duplicate values.

40. What is a full binary tree ?
A full binary tree (sometimes proper binary tree or 2-tree) is a tree in which every node other than the leaves has two children. A complete binary tree is a binary tree in which every level, except possibly the last, is completely filled, and all nodes are as far left as possible.

Author: user

Leave a Reply