Browse Source

update rotate mehtod

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> {
108 108
 		if(this.size==0 || this.size==1) { 
109 109
 			return;
110 110
 		}
111
+		// Make circular
111 112
 		tail.setNext(this.head);
112
-		head = this.head.getNext();
113 113
 		tail = tail.getNext();
114
+		
115
+		// Circular
116
+		head = tail.getNext();
117
+
118
+		// Break circle
114 119
 		tail.setNext(null);
120
+
115 121
 	}
116 122
 
117 123
 	/** Add item to front of list. */