GATE CS 2025 Set 2 | Question 38

Programming & Data Structures › Heaps · MCQ · 2 marks · Answer: A

  1. Question 38Programming & Data Structuresmcq2 marks
    A meld combines two instances of a data structure into one. Consider: P: Unsorted doubly linked list with head and tail pointers. Q: Min-heap implemented using an array. R: Binary Search Tree. Which ONE gives the worst-case time complexities for melding instances of size ?
    • A.
      P: , Q: , R:
      ✓
    • B.
      P: , Q: , R:
    • C.
      P: , Q: , R:
    • D.
      P: , Q: , R:

    Answer: A

    Solution

    Answer: (A) P: , Q: , R: - P: link the tail of one list to the head of the other — . - Q: concatenate the two arrays and run build-heap — . - R: in the worst case, merge by collecting elements and rebuilding; a balanced-independent merge takes (e.g. flatten one and insert / rebuild in linear time for the worst-case bound given). Option (A) matches.

More GATE PYQ on Heaps

All GATE CS Programming & Data Structures PYQ →

Attempt GATE CS 2025 Set 2 in real GATE exam mode

Full paper with a timer, the GATE interface and a topic-wise analysis — free.

Create free account →