Question 9525 – Heap-Tree
January 17, 2024Question 7137 – NVS PGT CS 2019 Part-A
January 18, 2024GATE 2006
Question 10
|
In a binary max heap containing n numbers, the smallest element can be found in time
O(n)
|
|
O(log n)
|
|
O(log log n)
|
|
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.
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.
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.
Subscribe
Login
0 Comments