Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

reverse a linked list C#

//ll is the LinkedList
//using System.Linq
foreach(string item in ll.ToArray()){ll.AddFirst(item);ll.RemoveLast();}

//without using System.Linq

List<string> lll = new List<string>(ll);
for(int i=0;i<ll.Count;i++){ll.AddFirst(lll[i]);ll.RemoveLast();}
 
PREVIOUS NEXT
Tagged: #reverse #linked #list
ADD COMMENT
Topic
Name
6+2 =