A binary tree is a collection of elements called nodes. The collection is either empty or it consists of a node called the root, along with two binary trees called the left and right subtrees. The roots of the left and right subtrees are children of the root; the root is the parent of these children. An edge connects each node of a binary tree to e...
Read MoreA heap is a partially ordered complete binary tree. To say that a heap is partially ordered is to say that there is some relationship between the value of a node and the values of its children. In a min-heap, the value of a node is less than or equal to the values of its children. In a max-heap, the value of a node is greater than or equal to the v...
Read MoreThe height of a node in a heap is the number of edges on the longest simple downward path from the node to a leaf, and the height of the heap to be the height of the root, that is Θ(lgn). Consider the following heap: The height of node number 2 is 2 The height of the heap is 3
Read More