Open In App
Related Articles

ISRO | ISRO CS 2008 | Question 69

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

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

(A)

Deleting a node whose location is given

(B)

Searching an unsorted list for a given item

(C)

Inserting a node after the node with a given location

(D)

Traversing the list to process each node



Answer: (A)

Explanation:

Doubly linked lists have a few advantages over linear linked lists when it comes to certain operations. Specifically, the following operation is performed more efficiently by a doubly linked list than by a linear linked list

Deleting a node given a pointer to the node.

In a linear linked list, deleting a node requires traversing the list to find the node to be deleted and its predecessor. Once these nodes have been found, the predecessor’s next pointer is updated to skip over the node to be deleted. This operation takes O(n) time in the worst case, where n is the number of nodes in the list.



Quiz of this Question
Please comment below if you find anything wrong in the above post

Last Updated : 08 Jun, 2018
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads