GATE CS 2016, set 2 · Question 25 · Programming and Data Structures · Multiple choice (MCQ) · 1 mark · −1/3 for a wrong answer

N items are stored in a sorted doubly linked list. For a delete operation, a pointer is provided to the record to be deleted. For a decrease-key operation, a pointer is provided to the record on which the operation is to be performed.
An algorithm performs the following operations on the list in this order: Θ(N) delete , O(log N) insert , O(log N) find , and Θ(N) decrease-key . What is the time complexity of all these operations put together?

  1. (A) O(log² N)
  2. (B) O(N)
  3. (C) O(N²)
  4. (D) Θ(N² log N)
Answer

Answer (C)

Answer from the official GATE CS 2016 answer key.

The step-by-step solution, where available, is part of GATE CS Pro. See what Pro includes