JavaGian java tutorial and java interview question and answer

JavaGian , Free Online Tutorials, JavaGian provides tutorials and interview questions of all technology like java tutorial, android, java frameworks, javascript, ajax, core java, sql, python, php, c language etc. for beginners and professionals.

Showing posts with label Binary-Tree. Show all posts
Showing posts with label Binary-Tree. Show all posts

Explain Binary Tree?

10:53 PM
Binary Tree Binary Tree is a special type of generic tree in which, each node can have at most two children. Binary tree is generally partitioned into three disjoint subsets. Root of the node left sub-tree which is also a binary tree. Right binary sub-tree A binary Tree is shown in the following image.   Types of Binary Tree 1. Strictly Binary Tree In Strictly Binary Tree, every non-leaf node contain non-empty left and right sub-trees. In other words, the degree of every non-leaf node will always be 2. A strictly binary tree with n leaves, will have (2n - 1) nodes. A strictly binary tree is shown in the following figure.   2. Complete Binary Tree A Binary Tree is said to be a complete binary tree if all of the leaves are located at the same level d. A complete binary tree is a binary tree that contains exactly 2^l nodes at each level between level 0 and d. The total number of nodes in a complete binary tree with depth d is 2 d+1 -1 where leaf nodes are 2 d  whi

.