Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

reversing linkedlist C#

Node p = root, n = null;
while (p != null) {
    Node tmp = p.next;
    p.next = n;
    n = p;
    p = tmp;
}
root = n;
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #reversing #linkedlist
ADD COMMENT
Topic
Name
3+4 =