The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 405 Weeks Ago, 6 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
1-Show what the array would look like at each step when the heapIncreaseKey operation
(increase the key value of the 8th node from 2 to 20) is performed on the max-heap array shown
below:
heap = {16, 14, 10, 8, 7, 9, 3, 2, 4, 1}
2-Show what the array would look like at each step when the maxHeapInsert operation to
insert a new key with value 12 is performed on the max-heap array shown below:
heap = {16, 14, 10, 8, 7, 9, 3, 2, 4, 1, 5}
Note: For problems 4 and 5 above, the heapIncreaseKey and the maxHeapInsert operations were
discussed in the Priority Queue section of the lecture. Only show what the arrays look like after
each step of rearranging the nodes. No need to write a program or draw the binary trees.
Note: The answers for problems 4 and 5 would look something like this:
Step 0: heap = {16, 14, 10, 8, 7, 9, 3, 2, 4, 1}
Step 1: heap = {[the sequence of numbers after step 1]}
Step 2: heap = {[the sequence of numbers after step 2]}
. . .
Finally: heap = {[the sequence of numbers after completion]}
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll