recategorized by
803 views
0 votes
0 votes
Consider unsorted doubly linked list data structure containing n items. For decrease key operation a pointer is provided to the record on which the operation is performed. An algorithm performs the following operations on the list in this order: sqrt(n) insert operations, o(nlogn) decrease key and O(n) find operations. What is the time complexity of all these operations put together?

(a) O(n)

(b) O(n2)

(c) O(n2logn)

(d) O(sqrt(n))
recategorized by

1 Answer

0 votes
0 votes

For unsorted doubly linked list :

Insert - O(1)

decrease key - O(1) 

find - O(n)

total = √n *O(1) + nlogn*O(1) +  n* O(n) = O(n2)

 

No related questions found