Exemple #1
0
        public void display()
        {
            CNode temp = start;

            do
            {
                Console.Write($"{temp.value}->");
                temp = temp.next;
            } while (temp != start);
            Console.WriteLine();
        }
Exemple #2
0
        public void Dispose()
        {
            CNode temp = start;

            while (temp != start)
            {
                temp.Dispose();
                temp = temp.next;
            }
            start = null;
        }
Exemple #3
0
        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;
            }
        }
Exemple #4
0
        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;
            }
        }
Exemple #5
0
 public void Dispose()
 {
     next = null;
 }