Пример #1
0
        public int deletefront()
        {
            int i    = 0;
            nde temp = head;

            if (head.item != 0)
            {
                if (head.next != null)
                {
                    while (temp.next.next != null)
                    {
                        temp = temp.next;
                    }
                    i         = temp.next.item;
                    temp.next = null;
                    return(i);
                }
                else
                {
                    i    = head.item;
                    head = null;
                    return(i);
                }
            }
            else
            {
                Console.WriteLine("list is empty");
                return(i);
            }
        }
Пример #2
0
        public void insertlast(int data)
        {
            nde newnode = new nde();

            newnode.item = data;
            newnode.next = head.next;
            head         = newnode;
        }
Пример #3
0
        public int  deletelast()
        {
            int i = 0;

            if (head.item == 0)
            {
                Console.WriteLine("list is empty");
                return(i);
            }
            else
            {
                i    = head.item;
                head = head.next;
                return(i);
            }
        }
Пример #4
0
        public void insertfront(int data)
        {
            nde newnode = new nde();

            newnode.item = data;
            nde temp = head;

            if (head.item == 0)
            {
                head = newnode;
            }
            else
            {
                while (temp.next != null)
                {
                    temp = temp.next;
                }
                temp.next = newnode;
            }
        }
Пример #5
0
 public linked()
 {
     head = null;
 }
Пример #6
0
 public nde()
 {
     item = 0;
     next = null;
 }