Today I'd like to give codes and solution to reverse a singly linked list in a single pass and not using superfluous storage. Off course there is a solution if you duplicate list, put all values into a vector or array, and other not efficient ways to accomplish this task. Recursive solutions could also be proposed. … Continue reading Reversing a singly linked list in a single pass
Tag: singly linked list
Spliting a singly linked list into two sub-lists from the middle node in one pass
This is a puzzle like problem for linked lists. We'll use similar solution for our code in Finding The Half Of Linked List in Single Traversal. But we'll add some spice to the code in order to convert solution to be applied to this problem. Ok let's have a look to our proposed solution. When we get the … Continue reading Spliting a singly linked list into two sub-lists from the middle node in one pass