Tree
Practice Questions
Binary Trees
Binary trees
Binary trees are a type of tree Data structures where the child nodes can be upto two for each node. They are referred to as left and right child.
Terminology:
Root node: The top most node is called root node.
Child nodes: The nodes which are followed from the root node are called child nodes and the nodes followed from these child nodes are also called child nodes of these particular nodes.
Parent nodes: The nodes which are preceded are called parent nodes. Here the top 2 is the parent node of 7 and 5. Two nodes prior to a particular node is the grand parent of that node and the particular node is grand child of the two prior node. Here 2,6,9,11 are grand children of 2 and 2 is grand parent of 2,6,9,11.
Leaf nodes: The bottom nodes are called leaf nodes.Here 4,3,2,8,7 are leaf nodes.
Levels: The depth is called by the term level. In the above example there are 3 levels.
If a tree structure has only 1 child node for each node then it is similar to the linked list data structures.
Try here>>>