...
/Solution Review: Finding the Length of a Linked List
Solution Review: Finding the Length of a Linked List
This review provides a detailed analysis on finding the length of a linked list.
We'll cover the following...
Solution: Linear iteration
Press + to interact
main.cs
LinkedList.cs
using System;namespace chapter_3{class Challenge_4{static void Main(string[] args){LinkedList list = new LinkedList(); // created linked listfor (int i = 1; i <= 8; i++){list.InsertAtHead(i); // inserting data in listlist.PrintList();}int listLength = list.Length(); // calling length functionConsole.WriteLine("Length of the list is " + listLength + "!");return;}}}
The ...