<p>can anyone explain heaps plz? thx.</p>
<p>there’s 2 kinds of heaps, min and max heaps. in a min-heap, each treenode is less than its two child notes. a max heap, each treenode is greater than its two child notes. heaps are drawn like trees on paper, but are implemented through primitive arrays (at least that’s how AP is supposed to test it). the tree is converted over to the arraylist via simple algorithim. the root node is designated as 1, the root node’s left node is designated as 2, and the root node’s left node is designated as 3. essentially, the index positions correlate in the way that you read a book. the root of the tree is stored in position 1 of the array (position 0 is ALWAYS empty). for any treenode numbered N, its left child will be at position 2 * N, and its right child will be at 2 * N + 1. this way you can get the benefits of direct access of an array and its easy to work with while getting performance of a tree.</p>
<p>don’t forget a for loop</p>