14,697 views
5 votes
5 votes

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

  1. Deleting a node whose location is given
  2. Searching an unsorted list for a given item
  3. Inserting a node after the node with a given location
  4. Traversing the list to process each node

3 Answers

Best answer
12 votes
12 votes

ANSWER: (1) Deleting a node whose location is given.

REASON:

In this question, we can simply eliminate the (2) and (4) from our choice, since in both the cases we need to visit every node one after other. Doubly LL will serve no extra good in these two cases as we need to proceed from starting node and go until the last note in LL or vice-versa .

(2)  To insert a new node in the LL after some specific node, we need not go back to the previous node in the LL. And thus, doubly LL will serve no purpose in this case too.

At last, in the case of (1) we are supposed to delete the node (say x) whose location is given. Which means that before we remove node x from the LL we need to store the address of next node in the list, linked to node x in the address field of node just before node x (which currently store the address of node x). Since we need to go back-and-forth in the list during this operation, doubly linked list will be a good help in increasing the efficiency by decreasing the time required for the operation.


LL referes to Linked List

selected by
2 votes
2 votes

Answer is A) as it takes  O(1) to delete from doubly linked list as compared to O(n) from single linked list only in case tail pointer is given otherwise both will take O(n).

So for deletion if we take tail pointer then DLL is efficient

Answer:

Related questions

2 votes
2 votes
1 answer
1
go_editor asked Jun 13, 2016
17,938 views
The time required to search an element in a linked list of length n is$O(\log_2 n)$$O(n)$$O(1)$$O(n^2)$
2 votes
2 votes
5 answers
2
ajit asked Sep 20, 2015
19,572 views
The minimum number of fields with each node of doubly linked list is1234
4 votes
4 votes
1 answer
3
go_editor asked Jun 13, 2016
3,246 views
A complete binary tree with the property that the value at each node is at least as large as the values at its children is known asbinary search treeAVL treecompletely ba...
9 votes
9 votes
1 answer
4