Vidyalelo
Data Structure · all questions

Heaps
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

166

Questions

1/9

Page

Pick an option on a question to see the right answer and solution.

What is the time complexity of inserting an element into a binary heap?

Select an option to see the answer and solution.

Which of the following is true for a min-heap?

Select an option to see the answer and solution.

In a max-heap, which node property is true?

Select an option to see the answer and solution.

How do you maintain the heap property after deleting the root node?

Select an option to see the answer and solution.

Which data structure is commonly used to implement priority queues?

Select an option to see the answer and solution.

What is the height of a complete binary heap with n nodes?

Select an option to see the answer and solution.

What is the primary operation performed when adjusting a heap after insertion or deletion?

Select an option to see the answer and solution.

In a binary heap, how is the parent node index calculated from a child node index i?

Select an option to see the answer and solution.

What is the time complexity of building a heap from an unsorted array?

Select an option to see the answer and solution.

How do you find the maximum element in a max-heap?

Select an option to see the answer and solution.

What is the main advantage of using a binary heap for implementing a priority queue?

Select an option to see the answer and solution.

In a min-heap, what happens when you decrease the value of a node?

Select an option to see the answer and solution.

Which operation is used to extract the minimum element from a min-heap?

Select an option to see the answer and solution.

What is the time complexity of extracting the maximum element from a max-heap?

Select an option to see the answer and solution.

How are heaps commonly used in algorithms?

Select an option to see the answer and solution.

In a binary heap, which of the following operations is O(log n) in time complexity?

Select an option to see the answer and solution.

What is the main difference between a binary heap and a binary search tree?

Select an option to see the answer and solution.

How do you restore the heap property after extracting the maximum element from a max-heap?

Select an option to see the answer and solution.

Which property does not apply to a min-heap?

Select an option to see the answer and solution.

What is the time complexity of decreasing a key value in a min-heap?

Select an option to see the answer and solution.