GATE / CS ARCHIVE

GATE CSE 1997 / QUESTION 1.4

Constant-time list concatenation

Data Structures · Arrays & Linked Lists · Full GATE CSE 1997 paper

GATE 1997, Q1.4 1 mark · MCQ
Report issue

Arrays & Linked Lists

Question 1.4, GATE 1997: Which standard representation permits O(1) concatenation: singly linked, doubly linked, circular doubly linked, or array list?
Tap to enlarge
Your answer
Answer & solution

Answer: C with head-only representations; stored tails also suffice (no official key was published)

A circular doubly linked list exposes its tail as head.prev. For nonempty lists with heads h1, h2 and tails t1, t2, set t1.next=h2, h2.prev=t1, t2.next=h1, h1.prev=t2. Only four links change, so concatenation is O(1), C. Empty-list cases need only pointer assignments. A head-only linear list requires traversal to find its tail, but an explicitly stored tail pointer also makes singly or doubly linked concatenation constant-time. Thus uniqueness of C depends on the usual representation metadata, not merely the link direction.

Original paper, page 1