Esempio n. 1
0
        public int this[int index]
        {
            set
            {
                int i = value;
                Node temp = new Node(i);
                if (start == null)
                {
                    start = temp;
                    temp = null;
                    return;
                }
                if (start != null && index==0)
                {
                    temp.NEXT = start;
                    start = temp;
                    temp = null;
                    return;
                }
                else
                {
                    int j = 1;
                    Node p = start;
                    while (p.NEXT != null)
                    {
                        if (j == index)
                        {
                            Node q = p.NEXT;
                            p.NEXT = temp;
                            temp.NEXT = q;
                            temp = null;
                            return;
                        }
                        p = p.NEXT;
                    }
                    p.NEXT = temp;
                    temp.NEXT = null;
                    temp = null;
                }

            }
        }
Esempio n. 2
0
 public Node(int d)
 {
     data = d;
     next = null;
 }
Esempio n. 3
0
 public Node()
 {
     data = 0;
     next = null;
 }
Esempio n. 4
0
 public LinkList()
 {
     start = null;
 }