Exemple #1
0
        public void Test1()
        {
            Node head = new Node(2);
            Node ptr = head;
            foreach (int num in new int[] {8, 9, 2, 1, 9, 9, 5, 5, 7, 0}){
                ptr.next = new Node(num);
                ptr = ptr.next;
            }

            head.PrintTail();
            _01.RemoveDuplicates(head);
            head.PrintTail();
        }
Exemple #2
0
        public void Test2()
        {
            Node head = new Node(1);
            Node ptr = head;
            foreach (int num in new int[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 })
            {
                ptr.next = new Node(num);
                ptr = ptr.next;
            }

            head.PrintTail();
            _01.RemoveDuplicates(head);
            head.PrintTail();
        }
Exemple #3
0
        public void Test()
        {
            Random rand = new Random();

            Node head = new Node(rand.Next(0, 10));
            Node ptr = head;

            for (int i = 0; i < 10; i++)
            {
                ptr.next = new Node(rand.Next(0, 10));
                ptr = ptr.next;
            }

            head.PrintTail();
            _01.RemoveDuplicates(head);
            head.PrintTail();
        }