Solution Review: Find Middle Node of a Linked List
This review provides a detailed analysis on solving the "Find Middle Node of a Linked List" challenge.
We'll cover the following...
Solution: Two pointers
Press + to interact
main.cs
LinkedList.cs
using System;namespace chapter_3{class Challenge_7{static void Main(string[] args){LinkedList list = new LinkedList();var rand = new Random();int num = 0;for (int i = 1; i <= 5; i++){num = rand.Next(10); //generating random numbers in range 1 to 100list.InsertAtHead(num); // inserting value in the listlist.PrintList();}int mid = list.FindMid(); //calling findMid functionConsole.WriteLine("Middle element of the list : " + mid);return;}}}
...