public static void Unorder() { String filePath = @"C:\Users\Neelabh\Desktop\GitHub\dataStructure\DataStructures\DataStructures\TextFile1.txt"; String text = System.IO.File.ReadAllText(filePath); string [] str = text.Split(" "); MyLinkedList ll = new MyLinkedList(); for (int i = 0; i < str.Length; i++) { ll.AddLast(str[i]); } ll.Display(); Console.WriteLine("enter the string"); string s = Console.ReadLine(); bool b = ll.CheckLL(s); if (b == true) { Console.WriteLine("remove the element from the list"); ll.DeleteLL(s); } else { Console.WriteLine("Adding the element at the last of the list"); ll.AddLast(s); } ll.Display(); // to change the .txt file ll.WriteFile(); }
static void Main(string[] args) { var list = new MyLinkedList <int>(); var state = list.AddLast(1); list.AddLast(2); list.AddLast(3); list.AddLast(4); list.AddLast(5); //foreach (var item in stack) //{ // Console.WriteLine(item); //} var ans2 = list.Check(4); foreach (var item in list) { Console.WriteLine(item); } Console.WriteLine(ans2); Console.WriteLine(state); }
public static void Demo() { var mylist = new MyLinkedList <object>(); mylist.PrintList(); mylist.AddFirst(1); mylist.AddFirst(2); mylist.AddFirst(3); mylist.AddLast(4); mylist.AddLast(6); mylist.AddLast("Basant"); mylist.AddFirst("abc"); mylist.PrintList(); Console.WriteLine("printing for each"); foreach (var item in mylist) { Console.WriteLine(item); } Console.WriteLine("for each completed.."); var arr = new object[10]; mylist.CopyTo(arr, arr.Length); Console.WriteLine(arr[6]); mylist.Remove("Basant"); mylist.PrintList(); while (mylist.Count > 0) { mylist.RemoveLast(); mylist.PrintList(); } }
public void Push(T item) { _stack.AddLast(item); }