예제 #1
0
 public List()
 {
     head = new ListElement();
     head.SetNum(0);
     head.SetNext(null);
     length = 0;
 }
예제 #2
0
파일: List.cs 프로젝트: kosya/for_study
 public List()
 {
     head = new ListElement();
     head.SetNum(0);
     head.SetNext(null);
     length = 0;
 }
예제 #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;
 }
예제 #4
0
파일: List.cs 프로젝트: kosya/for_study
 public virtual void Insert(int value, ListElement pos)
 {
     ListElement temp = new ListElement();
     temp.SetNum(value);
     temp.SetNext(pos.GetNext());
     pos.SetNext(temp);
     ++length;
 }
예제 #5
0
파일: List.cs 프로젝트: kosya/for_study
 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;
 }
예제 #6
0
파일: List.cs 프로젝트: kosya/for_study
        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);
        }