ISRO Computer Science (CSE) 2014 - Question 49

All ISRO Computer Science (CSE) papers | ISRO Computer Science (CSE) 2014

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 lists?

  • A. Delete the first element of the list
  • B. Interchange the first two elements of the list
  • C. Delete the last element of the list
  • D. Add an element at the end of the list

Answer: C. Delete the last element of the list

Explanation: To delete the last element, we need to update the `next` pointer of the second-to-last element. With only F and L, we cannot access the second-to-last element directly; we must traverse from F. Time is $O(n)$.

| | All questions of ISRO Computer Science (CSE) 2014