static void Main(string[] args) { LinkedList ls = new LinkedList(); ls.Add(21); ls.Add(22); ls.Add(23); ls.Add(24); ls.Add(25); ls.Add(26); ls.Add(26); ls.InsertAt(7, 30); ls.RemoveAt(8); object obj = ls.getelementAt(6); Console.WriteLine("Linked List"); ls.PrintAllNodes(); Console.WriteLine(); Lstack lstk = new Lstack(); lstk.push(21); lstk.push(22); object se = lstk.pop(); Node ex = (Node)se; Console.WriteLine("Stack using linked list"); Console.WriteLine(ex.Value); se = lstk.pop(); ex = (Node)se; Console.WriteLine(ex.Value); Console.WriteLine(); LQueue lQ = new LQueue(); lQ.Enqueue(21); lQ.Enqueue(22); se = lQ.Dequeue(); ex = (Node)se; Console.WriteLine("Queue using linked list"); Console.WriteLine(ex.Value); se = lQ.Dequeue(); ex = (Node)se; Console.WriteLine(ex.Value); Console.ReadLine(); }
public static LQueue Create(int[] values) { var q = new LQueue(); for (int i = 0; i < values.Length; i++) { q.Enqueue(values[i]); } return(q); }