Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
1.3k views
in Information Technology by (113k points)
closed by
In a binary max heap containing n numbers, the smallest element can be found in ______ time.  
1. O(n)
2. O(log2 n)
3. O(1)
4. O(log2 log2 n)

1 Answer

0 votes
by (114k points)
selected by
 
Best answer
Correct Answer - Option 1 : O(n)

The correct answer is option 1.

  • The heap's smallest values will always be present on the last level or second last of the heap in a MAX heap, and the time complexity of reaching the last level of the heap is O(n).
  • We must use a linear search to search all of the elements in order to find the smallest element and heap.
  • It will take O(n) time to traverse all of the elements using linear search. 

Hence the correct answer is O(n).

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...