GATE CSE 2025 Session 2 Q38: Worst-case meld time for list, array heap and BST
- Programming and Data Structures
- 2 marks
- MCQ
- −2/3 if wrong
Question
A meld operation on two instances of a data structure combines them into one single instance of the same data structure. Consider the following data structures:
P: Unsorted doubly linked list with pointers to the head node and tail node of the list.
Q: Min-heap implemented using an array.
R: Binary Search Tree.
Which ONE of the following options gives the worst-case time complexities for meld operation on instances of size of these data structures?
Try it: multiple choice: exactly one correct option
Show answer and explanation
Answer: A (official GATE 2025 final answer key)
Concept used: Splice lists by pointers; rebuild a heap bottom-up in linear time; merge two BSTs through their sorted in-order sequences.
First step: Concatenate the two heap arrays and run build-heap; for BSTs, merge the two in-order lists and build a balanced tree from the sorted result.
Full step-by-step solution
Detailed working, common mistakes and linked mock tests will be available with a free GATEiit account. Log-in is coming soon.
Share this question
Source: official GATE 2025 Session 2 CS question paper and final answer key, organised by IIT Roorkee. Question paper · Answer key
More Programming and Data Structures PYQs
- 2026 Session 1 · Q23Non-leaf indices in a 1-indexed binary heap with n odd
- 2026 Session 1 · Q24Empty slots after linear-probing inserts with h(x) = (x+7) mod 11
- 2026 Session 1 · Q33Maximum height of a full binary tree with 23 nodes
- 2026 Session 1 · Q34Output of a C function with a shadowed block variable
- 2026 Session 1 · Q39Recursive length of a non-empty singly linked list
- 2026 Session 1 · Q40Third insertion that can never yield a complete BST of 1..15