Ejemplo n.º 1
0
 public List()
 {
     head = new ListElement();
     head.SetNum(0);
     head.SetNext(null);
     length = 0;
 }
Ejemplo n.º 2
0
 public List()
 {
     head = new ListElement();
     head.SetNum(0);
     head.SetNext(null);
     length = 0;
 }
Ejemplo n.º 3
0
 public virtual void Insert(int value, ListElement pos)
 {
     ListElement temp = new ListElement();
     temp.SetNum(value);
     temp.SetNext(pos.GetNext());
     pos.SetNext(temp);
     ++length;
 }
Ejemplo n.º 4
0
 public virtual void Insert(int value, ListElement pos)
 {
     ListElement temp = new ListElement();
     temp.SetNum(value);
     temp.SetNext(pos.GetNext());
     pos.SetNext(temp);
     ++length;
 }
Ejemplo n.º 5
0
 public void Remove(ListElement pos)
 {
     ListElement temp = this.head;
     if (this.head.GetNext() == null)
         return;
     while (temp.GetNext() == null || temp.GetNext() != pos)
     {
         temp = temp.GetNext();
     }
     temp.SetNext(pos.GetNext());
     --length;
 }
Ejemplo n.º 6
0
        public bool Find(int value)
        {
            ListElement pos = this.First();

            while (pos.GetNext() != null)
            {
                if (pos.GetNext().GetNum() == value)
                {
                    return(true);
                }
                pos.SetNext(pos.GetNext());
            }
            return(false);
        }