CSE 214 Lecture Notes - Lecture 23: Binary Tree, Binary Search Tree, Data Element
Document Summary
Important to know which indexes are the left/right children and the parent in the array for a heap. This works if there is no gaps meaning that it is a complete binary tree (full at all levels except possibly at the last level). An element smaller than the root can be placed in the right binary tree since the sides don"t matter in a heap as long as the smaller values are below the larger ones. The left size does not have to be larger than the left node. The goal is to make a complete tree. Remove the maximum data element from the heap. Heaps store the values in arrays. heapsize - number of elements maxsize - maximum number of elements. Place the new element in the first available position in the array. If the new element is greater, then swap it with its parent. The new element"s parent is greater than or equal to the new element.