CameraIcon
CameraIcon
SearchIcon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

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(logN) insert, O(logN) find, and Θ(N) decrease-key. What is the time complexity of all these operations put together?

A
O(N)
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
Θ(N2log N)
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
O(N2 )
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
D
O(log2 N)
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution

The correct option is C O(N2 )
Data structure usedFindinsertDelete Decrease keyOverall asympotic timeSorted doubly linkedlistO(NlogN)O(NlogN)O(N)O(N)O(NlogN)

Sorted doubly linked list take maxim um of O(N logN) time, but since not present in option
So, go for nearest value O(N2).

flag
Suggest Corrections
thumbs-up
1
similar_icon
Similar questions
View More
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Some Functions and Their Graphs
MATHEMATICS
Watch in App
Join BYJU'S Learning Program
CrossIcon