Question:

Which data structure is used to find largest number in data streams?

Show Hint

Max Heap: Root = Largest Element Min Heap: Root = Smallest Element
Updated On: Jun 25, 2026
  • Linked List
  • Heap
  • Splay Tree
  • 2-3 Tree
Show Solution
collegedunia
Verified By Collegedunia

The Correct Option is B

Solution and Explanation

Concept: A data stream continuously generates data items. To efficiently find the largest element at any time, a data structure should support:
• Fast insertion
• Fast retrieval of maximum value A Max Heap satisfies these requirements.

Step 1:
Recall Heap Property.
In a Max Heap: \[ \text{Parent} \ge \text{Children} \] Therefore the largest element is always stored at the root.

Step 2:
Analyze efficiency.
Insertion: \[ O(\log n) \] Finding maximum: \[ O(1) \] Hence heaps are highly suitable for data streams.

Step 3:
Compare with other structures.
Linked lists require linear search. Splay trees and 2-3 trees can perform the task, but heaps are the standard structure used for continuously maintaining largest values.

Step 4:
Write the answer.
Therefore, \[ \boxed{\text{Heap}} \] is the correct choice. Hence option (B) is correct.
Was this answer helpful?
0
0