//additional problem for Lab1 in DST
        public void AppendOredered(SortedLinkedList list2)
        {
            Node current2 = list2.head;

            while (current2 != null)
            {
                Add(current2.data);
                current2 = current2.next;
            }
            current2 = head;
            Node current;
            int  save = 0;

            for (bool swap = true; swap;)
            {
                swap = false;
                for (current = current2; current.next != null; current = current.next)
                {
                    if (current.data > current.next.data)
                    {
                        save              = current.data;
                        current.data      = current.next.data;
                        current.next.data = save;
                        swap              = true;
                    }
                }
            }
        }
        static void Main(string[] args)
        {
            SortedLinkedList list = new SortedLinkedList();

            Console.Write("List content: ");
            list.PrintList();
            list.Insert(-45);
            Console.WriteLine();
            Console.Write("List content: ");
            list.PrintList();
            list.Insert(0);
            Console.WriteLine();
            Console.Write("List content: ");
            list.PrintList();
            list.Insert(1235);
            Console.WriteLine();
            Console.Write("List content: ");
            list.PrintList();
            list.Insert(1);
            Console.WriteLine();
            Console.Write("List content: ");
            list.PrintList();
            list.Insert(-100);
            Console.WriteLine();
            Console.Write("List content: ");
            list.PrintList();
            Console.WriteLine("\nlength of a list: " + list.Length() + "\nRetrieving an item: " + list.Retrieve(0));
            Console.WriteLine("Retrieving an unexisting item: " + list.Retrieve(-1));
            Console.WriteLine("\nDeleting an item: " + list.DeleteItem(1235));
            Console.Write("List content after deleting: ");
            list.PrintList();
            Console.WriteLine("\nLength of a list: " + list.Length() + "\nSearching for an item and getting it's position: " + list.Search(1));
            Console.Write("Reversing a list: ");
            list.Reverse();
            list.PrintList();

            Console.WriteLine();
            SortedLinkedList list2 = new SortedLinkedList();

            list2.Insert(54);
            list2.Insert(12);
            list2.Insert(300);
            list2.Insert(54);
            list2.Insert(0);
            list2.Insert(-4);
            list2.PrintList();

            Console.WriteLine();
            list.AppendOredered(list2);
            list.PrintList();

            Console.ReadKey();
        }