How would you reverse a double linked list (turn 1,2,3 to 3,2,1) while keeping O(n) time and without creating new nodes? Could use some help on this. Thanks in advance!
5/17/2020 8:38:17 PM
Maybe you could iterate through every node and switch the links to the next and the prev node. And when you reach the last node you set the last node as root.
Learn Playing. Play Learning
Send us a message