Data Structures & AlgorithmsModerateCognizant · Capgemini pattern

Which statement about a doubly linked list compared with a singly linked list is FALSE?

  1. A. Deleting a node given only a pointer to it is O(1)
  2. B. The list can be traversed backwards from the tail
  3. C. Each node needs an extra pointer field
  4. D. Searching for a key becomes O(log n) because traversal can go both ways

Correct answer: D. Searching for a key becomes O(log n) because traversal can go both ways

Search is still a linear scan, O(n); two directions do not allow halving because there is no random access. The other three are true benefits and costs of the prev pointer.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic