3 ms·
I've always thought of reversing a linked list in a visual way. In my mind, a link list is a bunch of nodes with arrows pointing right. To reverse the list, al
by thisone 14y ago
I've always thought of reversing a linked list in a visual way.
In my mind, a link list is a bunch of nodes with arrows pointing right. To reverse the list, all I need to do is point the arrows to the left.
6(ish) lines of code later, and I've got a recursive reverse method.