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
1
combof123usingloop
Hello World!
Palindrome String
Palindrome
Fórum ➡ Using Regex to insert "item" tags into the unique "list" tag of an XML data ♦
Calculate Used Unit from Readings
Необязательные аргументы
Given a list of numbers and a number k, return whether any two numbers from the list add up to k
code source