Solved

Which of the Following Is the Algorithm for Insertion in a Heap

Question 22

Multiple Choice

Which of the following is the algorithm for insertion in a heap?


A) Insert the new item in the next position at the bottom of the heap.
while new item is not at the root and new item is smaller that its parent
Swap the new item with its parent, moving the item up the heap.
B) Insert the new item in the next position at the top of the heap.
while new item is at the root and new item is smaller that its parent
Swap the new item with its parent, moving the item up the heap.
C) Insert the new item in the next position at the bottom of the heap.
while new item is at the root and new item is larger that its parent
Swap the new item with its parent, moving the item up the heap.
D) Insert the new item in the next position at the bottom of the heap.
while new item is at the root and new item is smaller that its parent
Swap the new item with its parent, moving the item down the heap.

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents