Which of the following operations is performed more efficiently by doubly…

2008

Which of the following operations is performed more efficiently by doubly linked list than by linear linked list?

  1. A.

    Deleting a node whose location is given

  2. B.

    Searching an unsorted list for a given item

  3. C.

    Inserting a node after the node with a given location

  4. D.

    Traversing the list to process each node

Attempted by 421 students.

Show answer & explanation

Correct answer: A

In a singly linked list, each node contains a pointer to the next node only. To delete a specific node when given its location, you typically need access to the previous node's pointer. If only the target node is known, finding the previous node requires traversing from the head, taking O(n) time. In a doubly linked list, each node has pointers to both the next and previous nodes. Therefore, given a pointer to a node, you can directly access its predecessor in O(1) time and update the pointers accordingly to delete it. Thus, deleting a node whose location is given is more efficient in a doubly linked list.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Isro