Question 9525 – Heap-Tree

January 17, 2024

Question 7137 – NVS PGT CS 2019 Part-A

January 18, 2024

Question 9525 – Heap-Tree

January 17, 2024

Question 7137 – NVS PGT CS 2019 Part-A

January 18, 2024

GATE 2006

Question 10

In a binary max heap containing n numbers, the smallest element can be found in time

A
O(n)
B
O(log n)
C
O(log log n)
D
O(1)
Question 10 Explanation: 
In a MAX heap the smallest values of the heap will always be present on the last level of heap and time complexity of reaching the last level of heap is O(n).
We have to search all the elements to reach the smallest element and heap using linear search.
To traverse all elements using linear search will take O(n) time.
Correct Answer: A
Question 10 Explanation: 
In a MAX heap the smallest values of the heap will always be present on the last level of heap and time complexity of reaching the last level of heap is O(n).
We have to search all the elements to reach the smallest element and heap using linear search.
To traverse all elements using linear search will take O(n) time.

Leave a Reply

Your email address will not be published. Required fields are marked *