Binary trees are data structures where every node has at most two children, a left and right child. A binary tree has a root node at the top and leaf nodes at the bottom with no children. The depth of a node is the length of the path from the root to that node, while the height is the length of the longest path between the root and a leaf plus one. Binary trees can be full, complete, or fully complete depending on how nodes are distributed. Common operations on binary trees include searching, summing nodes, and traversing them in inorder, preorder, or postorder sequences.
6. Depth of a node
• The length of the path from the root to the
node.
• Depth(root)=0
7. Height of the tree
• The height of a node is the length of the
longest downward path between the node
and a leaf + 1.
• The height of a node is the length of the
longest downward path between the root and
a leaf +1.
9. Full Binary Tree
• Every node has 2 children except the leaves.
10. Complete Binary Tree
• 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.
11. • A fully complete binary tree has n nodes what
is the height of the tree?
12. • A fully complete binary tree has n nodes what
are the number of leaves in the tree?