Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Linked List
// Linked List using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { LinkedList lst=new LinkedList(); lst.AddAtStart(1); lst.AddAtLast(2); lst.AddAtLast(3); lst.AddAtLast(4); lst.Show(); } } public class LinkedList { private Node current, Head; public LinkedList() { Head =new Node(); Head.Next=null; current=Head; } public void AddAtStart(object val) { Node newNode =new Node(); newNode.Value=val; newNode.Next=null; Head.Next=newNode; current=Head.Next; } public void AddAtLast(object obj) { Node newNode=new Node(); newNode.Value=obj; newNode.Next=null; current.Next=newNode; current=newNode; } public void Show() { Node node=Head.Next; while(node!=null) { Console.Write(node.Value + " ,"); node=node.Next; } } } public class Node { public object Value; public Node Next; } }
run
|
edit
|
history
|
help
0
Masking Credit Card Number
Fórum GroupBy ➡ Sum & Aggregate customers' names
Unsorted Parallel Arrays finding min & max values.
Overloading Unary operator ~ (to reverse the string)
BNV
Tarkov Time
01-SI
Olymp
1stoccurence
Дамир