in Programming in C
421 views
0 votes
0 votes
What is the minimum runtime to reverse a doubly linked list?

answer given O(n) . shouldn't it be O(1) ?
in Programming in C
421 views

4 Comments

but the during the definition of structure we define what is left node and what is right node by left and right pointers.

What is meaning of this ???

0
0
you define how the node of doubly linked list should be using structures right.

If you want to access the left part of the node you access it by node->left but if you just change the head and use node-> left it will still point to left node itself (it doesn't point to right) as we want the left node to be right node and right to be left after reversing.

Am I clear now?
1
1
Ok.
0
0

Please log in or register to answer this question.

Related questions