84 views in DS
recategorized | 84 views
0

O(n) time since you need to reach last node which point to new first node.

For circular double linked list it takes O(1).

0
Yea exactly but in Ace its Given option B as answer
0
Actually if all option are in terms of O then O(n) is correct but here we have to choose most appropriate here it will always take (n) time so theata(n) is more appropriate.
0
in worst case also you have to traverse total linked list and in best case also you have to traverse total linked list

therefore it is ϴ ( n )
0
Sir Please Elaborate. I didn't get why Theta(n) :)
0
ohk thnku
0
Big oh means in worst case it takes n but it can takes constant also , But Theata(n) means always takes n .

I try to explain in terms of number of comparision :

Theata(n) = Number of comaparision can be n-4,n-1, n-2, etc i.e. n assmptotically n.

O(n) means   Number of comaparision can be 1, ,2,3,4,4,5,5,6....n etc not garunteed n but we are sure it cannot go beyond n.

inserting new node  1st check node  rear node -->next is  front

it will take o(n)
by (201 points)