public int Deldata() { if (this.next == this) { System.Console.WriteLine("\nOnly one node..."); return(0); } CircularLinkedList node = this.next; this.next = this.next.next; node = null; return(1); }
public void Traverse(CircularLinkedList node) { if (node == null) { node = this; } System.Console.WriteLine("Forward Direction..."); CircularLinkedList snode = node; do { System.Console.WriteLine(node.current); node = node.next; } while (node != snode); }
public CircularLinkedList Insdata(int value) { CircularLinkedList node = new CircularLinkedList(value); if (this.next == this) { node.next = this; this.next = node; } else { CircularLinkedList temp = this.next; node.next = temp; this.next = node; } return(node); }
public int Gnodes(CircularLinkedList node) { if (node == null) { node = this; } int count = 0; CircularLinkedList snode = node; do { count++; node = node.next; } while (node != snode); System.Console.WriteLine("\nCurrent Node Value : " + node.current.ToString()); System.Console.WriteLine("\nTotal nodes :" + count.ToString()); return(count); }
public CircularLinkedList(T value) { current = value; next = this; }