Browse Source

update rotate mehtod

master
Charles Reid 2 years ago
parent
commit
6755d2a531
1 changed files with 7 additions and 1 deletions
  1. +7
    -1
      lists/linked-lists/TLinkedList.java

+ 7
- 1
lists/linked-lists/TLinkedList.java View File

@@ -108,10 +108,16 @@ public class TLinkedList<E> {
if(this.size==0 || this.size==1) {
return;
}
// Make circular
tail.setNext(this.head);
head = this.head.getNext();
tail = tail.getNext();
// Circular
head = tail.getNext();

// Break circle
tail.setNext(null);

}

/** Add item to front of list. */

Loading…
Cancel
Save