ISRO Scientist/Engineer CSE 2014Data Structures › Linked Lists
ISRO Scientist/Engineer CSE 2014 PYQ: Consider a single linked list where $F$ and $L$ are pointers to the first and last elements respectively of…
Consider a single linked list where $F$ and $L$ are pointers to the first and last elements respectively of the linked list. The time for performing which of the given operations depends on the length of the linked list?
- ADelete the first element of the list
- BInterchange the first two elements of the list
- CDelete the last element of the listCorrect answer
- DAdd an element at the end of the list
Answer
(C) Delete the last element of the list
Approach
We have a singly linked list with head pointer F and tail pointer L. For each operation, determine whether it can be done using only F, L, and a constant number of node accesses, or whether it requires traversing the list from the head to find a predecessor node.
Reviewed by ISRO IQ Editorial Team.