• + 0 comments

    SinglyLinkedListNode* reverse(SinglyLinkedListNode* llist) { SinglyLinkedListNode* prev = NULL; SinglyLinkedListNode* current = llist; SinglyLinkedListNode* next = NULL; while (current != NULL) { next = current->next; current->next = prev; prev = current; current = next; } return prev;

    }