Пример #1
0
        public static void ReverseDemo()
        {
            LinkedListNodeOperations linkedListNodeOperations = new LinkedListNodeOperations();
            LinkedListNode           node = linkedListNodeOperations.GetNewList();

            Console.WriteLine("List Before Reversing:");
            var message = linkedListNodeOperations.PrintList(node);

            Console.WriteLine(message);

            LinkedListNode result = linkedListNodeOperations.Reverse(node);

            Console.WriteLine("List After Reversing:");
            message = linkedListNodeOperations.PrintList(result);
            Console.WriteLine(message);
        }
Пример #2
0
        public static void PartitionDemo()
        {
            LinkedListNodeOperations linkedListNodeOperations = new LinkedListNodeOperations();
            LinkedListNode           node = linkedListNodeOperations.GetNewList();

            Console.Write("Enter Data to do partition on: ");
            int data = int.Parse(Console.ReadLine());

            Console.WriteLine("List Before Partition:");
            var message = linkedListNodeOperations.PrintList(node);

            Console.WriteLine(message);

            LinkedListNode result = linkedListNodeOperations.Partition(node, data);

            Console.WriteLine("List After Partition:");
            message = linkedListNodeOperations.PrintList(result);
            Console.WriteLine(message);
        }