Example #1
0
        public void Concat(LinkListGen <T> tempList2)
        {
            LinkGen <T> temp = list;

            while (temp != null)
            {
                tempList2.AppendItem(temp.Data);
                temp = temp.Next;
            }
            list = tempList2.list;
        }
Example #2
0
        public void Copy(LinkListGen <T> tempList)
        {
            LinkGen <T> temp = list;

            while (temp != null)
            {
                tempList.AddItem(temp.Data);
                temp = temp.Next;
            }
            list = tempList.list;
        }
Example #3
0
        public void Sort()
        {
            LinkGen <T>     temp     = list;
            LinkListGen <T> tempList = new LinkListGen <T>();

            while (temp != null)
            {
                tempList.InsertInOrder(temp.Data);
                temp = temp.Next;
            }
            list = tempList.list;
        }
Example #4
0
        public void RemoveItem(T item)
        {
            LinkGen <T>     temp     = list;
            LinkListGen <T> tempList = new LinkListGen <T>();

            while (temp != null)
            {
                if (item.CompareTo(temp.Data) != 0)
                {
                    tempList.AddItem(temp.Data);
                }
                temp = temp.Next;
            }
            list = tempList.list;
        }
Example #5
0
        /*public void InsertInOrder(T item)
         * {
         *  bool added = false;
         *  LinkGen<T> temp = list;
         *  LinkListGen<T> tempList = new LinkListGen<T>();
         *  while (temp != null)
         *  {
         *      if ((temp.Data.CompareTo(item) >= 0) && (added == false))
         *      {
         *          tempList.AddItem(item);
         *          added = true;
         *      }
         *      tempList.AddItem(temp.Data);
         *      temp = temp.Next;
         *  }
         *  list = tempList.list;
         * }*/

        public void InsertInOrder(T item)
        {
            LinkGen <T>     temp     = list;
            LinkListGen <T> tempList = new LinkListGen <T>();

            while ((temp != null) && (temp.Data.CompareTo(item) < 0))
            {
                tempList.AppendItem(temp.Data);
                temp = temp.Next;
            }
            tempList.AppendItem(item);

            while (temp != null)
            {
                tempList.AppendItem(temp.Data);
                temp = temp.Next;
            }
            list = tempList.list;
        }