2 pointers.

Dark Mode

568 views

0 votes

Its a GATE question. Check explanation here https://gateoverflow.in/80298/Gate-cse-1987-question-1-xv

0 votes

Option - (C)

In a circular linked list, insertion of a record involves modification of two pointer.A circular linked list is a linked list in which the last node points to the head or front node making the data structure to look like a circle. There is no NULL at the end.For insertion of node in the beginning we need traverse the whole list. Also, for insertion and the end, the whole list has to be traversed. If instead of start pointer we take a pointer to the last node then in both the cases there won’t be any need to traverse the whole list. So insertion in the begging or at the end takes constant time irrespective of the length of the list.

In a circular linked list, insertion of a record involves modification of two pointer.A circular linked list is a linked list in which the last node points to the head or front node making the data structure to look like a circle. There is no NULL at the end.For insertion of node in the beginning we need traverse the whole list. Also, for insertion and the end, the whole list has to be traversed. If instead of start pointer we take a pointer to the last node then in both the cases there won’t be any need to traverse the whole list. So insertion in the begging or at the end takes constant time irrespective of the length of the list.