Exemplo n.º 1
0
        static void MergeSortedArray()
        {
            var number1 = new myLinkedList <int>
            {
                data = 2,
                Next = new myLinkedList <int>
                {
                    data = 5,
                    Next = new myLinkedList <int>
                    {
                        data = 6
                    }
                }
            };

            var number2 = new myLinkedList <int>
            {
                data = 1,
                Next = new myLinkedList <int>
                {
                    data = 3,
                    Next = new myLinkedList <int>
                    {
                        data = 99,
                        Next = new myLinkedList <int>
                        {
                            data = 100,
                            Next = new myLinkedList <int>
                            {
                                data = 1009,
                                Next = new myLinkedList <int>
                                {
                                    data = 1051,
                                }
                            }
                        }
                    }
                }
            };

            var obj = new CareerCupQnA();
            var res = obj.MergeSortedArray(number1, number2);

            while (res != null)
            {
                Console.WriteLine(res.data);
                res = res.Next;
            }
        }