Question 1.
In sorting 6,5.3.1.8.7.24 by heap sort a max heap is created by adding the elements one by one, then the first elements to be swapped are
Answer:
0 5,8
O 6,5
O 17
O
12:49
28
Type here to search
O
le
28°C AQI 25
ENG
12-06-2021
Answers
Answered by
0
Option(b), is the correct answer.
In heap sort, we add elements one at a time.
Therefore, the first element to be added is 6 Followed by 5.
Since 6 is greater than 5 but 6 is inserted in the heap before 5. 6 appears before 5. however the opposite should be the case.
Therefore, the first swapping will occur between 6 and 5.
Similar questions