static void Main(string[] args)
        {
            DoubleLinedList <int> list = new DoubleLinedList <int>();

            list.Add(13);
            list.Add(51);
            list.Add(1);
            list.Add(21);
            list.Add(4);

            list.Sort();
            for (int i = 0; i < list.Count; i++)
            {
                Console.WriteLine(list[i] + " ");
            }
        }
Esempio n. 2
0
        public static T[] ToArray(DoubleLinedList <T> list)
        {
            T[] array = new T[list.count];
            if (list.count == 0)
            {
                return(array);
            }
            int  index       = 0;
            Node currentNode = list.head;

            while (currentNode != null)
            {
                array[index] = currentNode.Value;
                currentNode  = currentNode.NextNode;
                index++;
            }
            return(array);
        }