static void Main(string[] args) { DoublyLinkedList <Vagon> Train = new DoublyLinkedList <Vagon>(); Vagon vagon0 = new Vagon(0, 10, 15); Vagon vagon1 = new Vagon(1, 15, 15); Vagon vagon2 = new Vagon(2, 20, 15); Vagon vagon3 = new Vagon(3, 25, 15); GetTrain(Train); Train.Add(vagon0); GetTrain(Train); Train.Add(vagon1); GetTrain(Train); Train.Add(vagon2); GetTrain(Train); Train.Add(vagon3, 0); GetTrain(Train); Train.Remove(vagon1); GetTrain(Train); Train.Remove(1); GetTrain(Train); Train.Edit(0, new Vagon(4, 120, 12)); GetTrain(Train); }
static void Main(string[] args) { DoublyLinkedList <int> list = new DoublyLinkedList <int>(); list.Add(5); list.Add(7); list.RemoveFirst(); list.AddFirst(5); list.RemoveLast(); list.AddLast(8); foreach (var item in list) { Console.WriteLine(item); } Console.ReadLine(); }
static void Main(string[] args) { for (int i = 0; i < 5; i++) { fstack.Push(i); stack.Push(i); queue.Enqueue(i); llist.Add(i); dllist.Add(i); cllist.Add(i); cdllist.Add(i); } for (int i = 0; i < 5; i++) { Write($"Fixed Stack: {fstack.Pop()}"); Write($"Stack: {stack.Pop()}"); Write($"Queue: {queue.Dequeue()}"); Write($"Linked List: {llist.Get(i).Data}"); Write($"Doubly Linked List: {dllist.Get(i).Data}"); Write($"Circular Linked List: {cllist.ToArray()[i]}"); Write($"Fixed Stack: {cdllist.ToArray()[i]}"); Write(null); } }