Binary Tree Overview Binary TreeComplete Binary treeAlmost complete Binary treeStrict Binary TreeRepresentation of Binary three Binary Tree A binary tree is defined as a finite set of elements ,called nodes, such thatT is empty (called the Nulltree or empty tree) , orT contains a distinguished node R,called the root of T,and the remaining nodes ofT form an ordered pair of disjoint binarytreesT1 and TzAny node in the binary tree has either 0 , I or 2 child nodes. Complete Binary Tree completeBinarytree.AM levels are completely filled Almost Complete Binary Tree All levels are completely filled,except possibily the last level and nodes in the last level are all left alinged. Strict Binary Tree Each node of a strict binary tree will have either 0 or 2 children. Representation of Binary Tree There are two possible representations of binary tree① Array Representation② Linked Representation ( by default) Array Representation Linked Representation Node:Root:root is a node referencewhen root contains null ,tree is empty. Discuss How to insert an item in a BT?How to traverse a BT ?Insert an elements in BT Traversing ptr.getitem();ptr=ptr.getleft();ptr=stack.pop()Logic to traverse a BT Iterative methodRecursive methodPreorder R T,Tz② Inorder T R T2③ postorder T1 T2 R PrevPreviousTree Data Structure Next AVL TreeNext Share on: