private static void reverseLinkedList(MyLinkedList linkedList) {Node current = linkedList.head;Node previous = null;Node next = null;while (current != null) {next = current.next;current.next = previous;previous = current;current = next;}linkedList.head = previous;}
Labels
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment