ISRO Scientist/Engineer CSE 2013Data Structures › Linked Lists
ISRO Scientist/Engineer CSE 2013 PYQ: The following steps in a linked list p = getnode() info(p) = 10 next (p) = list list = p result in which…
The following steps in a linked list
p = getnode()
info(p) = 10
next (p) = list
list = p result in which type of operation?
- APop operation in stack
- BRemoval of a node
- CInserting a nodeCorrect answer
- DModifying an existing node
Answer
(C) Inserting a node
Approach
Trace the effect of each statement on the linked list. A new node is allocated, its data field is set, its next pointer is linked to the existing list, and the list head is updated to point to the new node. This sequence is the standard way to insert a node at the beginning of a singly linked list.
Reviewed by ISRO IQ Editorial Team.