Fix number of noun (#38833)

Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>
This commit is contained in:
Ty Mick
2020-08-31 01:15:58 -04:00
committed by GitHub
parent 29ab6c32ec
commit 474ae28d72

View File

@ -26,7 +26,7 @@ Once you wrap your head around the math, using an array representation is very u
Instructions: Here we will create a max heap. Start by just creating an <code>insert</code> method which adds elements to our heap. During insertion, it is important to always maintain the heap property. For a max heap this means the root element should always have the greatest value in the tree and all parent nodes should be greater than their children. For an array implementation of a heap, this is typically accomplished in three steps: Instructions: Here we will create a max heap. Start by just creating an <code>insert</code> method which adds elements to our heap. During insertion, it is important to always maintain the heap property. For a max heap this means the root element should always have the greatest value in the tree and all parent nodes should be greater than their children. For an array implementation of a heap, this is typically accomplished in three steps:
<ol> <ol>
<li>Add the new element to the end of the array.</li> <li>Add the new element to the end of the array.</li>
<li>If the element is larger than its parents, switch them.</li> <li>If the element is larger than its parent, switch them.</li>
<li>Continue switching until the new element is either smaller than its parent or you reach the root of the tree.</li> <li>Continue switching until the new element is either smaller than its parent or you reach the root of the tree.</li>
</ol> </ol>
Finally, add a <code>print</code> method which returns an array of all the items that have been added to the heap. Finally, add a <code>print</code> method which returns an array of all the items that have been added to the heap.