...

/

Solution Review: Reverse a Linked List

Solution Review: Reverse a Linked List

This review provides a detailed analysis on solving the "Reverse a Linked List" challenge

We'll cover the following...

Solution #

Press + to interact
main.cs
LinkedList.cs
using System;
namespace chapter_3
{
class Challenge_5
{
static void Main(string[] args)
{
LinkedList list = new LinkedList(); //creating list
for (int j = 1; j <= 7; j++)
{
list.InsertAtHead(j); //insertng data in list
list.PrintList();
}
string reversed = list.Reverse(); // calling reverse function of list
Console.WriteLine("List after reverse function : " + reversed);
return;
}
}
}

The brain of this solution lies in the loop, which iterates through the ...