public void InsertInEmptyList(int data)
        {
            Node temp = new Node(data);

            last = temp;
            last.link = last;
        }
        public void Concatenate(CircularLinkedList list)
        {
            if (last == null)
            {
                last = list.last;
                return;
            }

            if (list.last == null)
            {
                return;
            }

            Node p = last.link;
            last.link = list.last.link;
            list.last.link = p;
            last = list.last;

        }
        public void InsertInBeginning(int data)
        {
            Node temp = new Node(data);

            temp.link = last.link;
            last.link = temp;
        }
        internal void DeleteLastNode()
        {
            // List is empty
            if (last == null)
            {
                return;
            }
            // The List has only one Node
            if (last.link == last)
            {
                last = null;
                return;
            }

            Node p = last.link;
            while (p.link != last)
            {
                p = p.link;
            }

            p.link = last.link;
            last =p;
        }
        internal void DeleteNode(int x)
        {
            // List is empty
            if (last == null)
            {
                return;
            }

            //Deletion of only one Note
            if (last.link == last && last.info == x)
            {
                last = null;
                return;
            }

            //Deletion of the first node.
            if (last.link.info == x)
            {
                last.link = last.link.link;
                return;
            }

            Node p = last.link;

            while (p.link != last.link)
            {
                if (p.link.info == x)
                {
                    break;
                }

                p = p.link;
            }

            if (p.link == last.link)
            {
                Console.WriteLine(x + "not found in the list.");
            }

            else
            {
                p.link = p.link.link;

                if (last.info == x)
                {
                    last = p;
                }
            }
        }
        internal void DeleteFirstNode()
        {
            // the list is empty
            if (last == null)
            {
                return;
            }

            // the list has only one Node.
            if (last.link == last)
            {
                last = null;
                return;
            }

            last.link = last.link.link;
        }
 public CircularLinkedList()
 {
     last = null;
 }
        public void InsertAfter(int data,int x)
        {
            Node p = last.link;

            do
            {
                if (p.info == x)
                {
                    break;
                }

                p = p.link;
            } while (p != last.link);

            if (p == last.link && p.info != x)
            {
                Console.WriteLine(x + " not present in the list<> ");
            }

            else
            {
                Node temp = new Node(data);

                temp.link = p.link;
                p.link = temp;

                if (p == last)
                {
                    last = temp;
                }
            }
        }
        public void InsertAtEnd(int data)
        {
            Node temp = new Node(data);

            temp.link = last.link;
            last.link = temp;
            last = temp;
        }
 public Node(int i)
 {
     info = i;
     link = null;
 }