Как отобразить простое число из двусвязного списка из текстового файла?
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);
}
}