Как напечатать простые числа в каждом списке (по пять чисел в каждой строке) из двусвязного списка c# - PullRequest
0 голосов
/ 06 апреля 2020

Как отобразить простое число из двусвязного списка из текстового файла?

 public void middleOfList()
        {

            if (head == null) ;
            if (head.next == null || head.next.next == null) ;


            Node slow = head, fast = head.next.next;

            // iterate till the middle element
            while (fast != null && fast.next != null)
            {
                slow = slow.next;//Add New nodeto the middle of the linked list.
                fast = fast.next.next; //Add new node to the last of the linked list.
            }


            if (fast != null) slow = slow.next;

            Console.WriteLine("The Middle number of list is: " + slow.data);
        } 

    }
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...