Which of the following operations is performed more efficiently by doubly linked list than by singly linked list?
(a) Deleting a node whose location in given
(b) Searching of an unsorted list for a given item
(c) Inverting a node after the node with given location
(d) Traversing a list to process each node
why the answer is A)
Since for deleting a node from any given location we have to move from head to that location for that we need a pointer for both doubly and singly linked list (say q)
Steps in doubly linked list are as follow:-
q->prev->next = q->next;
q->next->prev = q->prev;
free(q);
and steps in singly linked list :-
q->next = q->next->next;
free(q->next);
it is easy to delete in singly than in doubly.
crct me?