Data Structure interview questions


41. What is a Terminal node ?
A node with degree zero is call a terminal node or a leaf. Non-terminal node : Any node (except the root node) whose degree is not zero is called non-terminal node. Siblings : The children nodes of a given parent node are called siblings.

42. What is a tree ?
A tree is a set of nodes, perhaps empty. If not empty, there is a distinguished node r, called root and zero or more sub trees T1,T2,…..Tk each of whose roots are connected by a directed edge to r. The root of each subtree is called a child of r, and r is called the parent of each child.

43. What is a leaf nodes and interior nodes?
Nodes with no children are called leaf nodes. All other nodes are called interior nodes.

44. What is a depth of a node ?
The depth of a node is the number of edges from the node to the tree’s root node. A root node will have a depth of 0. The height of a node is the number of edges on the longest path from the node to a leaf. A leaf node will have a height of 0.

45. What is an internal node ?
A node of a tree that has one or more child nodes, equivalently, one that is not a leaf. Also known as non terminal node. See also parent, root.

Author: user

Leave a Reply

Your email address will not be published. Required fields are marked *