public void display() { CNode temp = start; do { Console.Write($"{temp.value}->"); temp = temp.next; } while (temp != start); Console.WriteLine(); }
public void Dispose() { CNode temp = start; while (temp != start) { temp.Dispose(); temp = temp.next; } start = null; }
public void insertInto(int data) { CNode node = new CNode() { value = data }; CNode temp = start; while (temp.next != start && !(temp.value < data && temp.next.value > data)) { temp = temp.next; } node.next = temp.next; temp.next = node; if (node.next == start) { start = node; } }
public void insert(int data) { CNode node = new CNode() { value = data }; CNode temp = start; //if the start node is null if (start == null) { start = node; node.next = node; } else { while (temp.next != start) { temp = temp.next; } temp.next = node; node.next = start; } }
public void Dispose() { next = null; }