LearnFrenzy
Sign in Take a free test

Data Structures in Java · Data Structures in Java MCQ · Question 17

Removing a known node from a doubly linked list Answer, explanation & discussion

  • MCQ
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 17 Back to Exercise

You already hold a reference to a node in a doubly linked list. What does it cost to remove that node?

  • A O(1) Correct
  • B O(log n)
  • C O(n)
  • D O(n²)
Correct Answer: Option A

Point node.prev.next at node.next and node.next.prev at node.prev. A singly linked list would first need to find the previous node: O(n).

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links