static void Main(string[] args) { var listOfIntegers = new LinkedList<int> {0, 1, 2, 3, 4, 5, 6, 7}; listOfIntegers.Remove(2); foreach (var entry in listOfIntegers) { Console.WriteLine(entry); } var hashMap = new HashMap<String, Int32>(); hashMap.Put("mike", 4); hashMap.Put("chris", 7); Console.WriteLine("KEY: 'mike'\t VALUE:{0}", hashMap.GetValue("mike")); foreach (var keyValuePair in hashMap) { Console.WriteLine(keyValuePair); } var tree = new Tree<int> {4, 6, 9, 2}; foreach (var value in tree) { Console.Write("{0}\t", value); } Console.Read(); }
public void Have_Ability_To_Add_To_Head_Or_Tail_Node() { LinkedList<int> list = new LinkedList<int>(); Node<int> headNode = new Node<int>(100); Node<int> tailNode = new Node<int>(200); list.AddToHead(headNode); list.AddToTail(tailNode); Assert.AreSame(headNode, list.Head); Assert.AreSame(tailNode, list.Tail); }
public void LinkedListMapTest() { var intList = new LinkedList<int>(); foreach (int i in a) intList.InsertFirst(i); Func<int, int> doubler = (x) => { return x * 2; }; intList.Map(doubler); //int[] b = a.Map<int, int>(doubler).ToArray(); }
public void Have_Count_Of_Current_Items() { LinkedList<int> list = new LinkedList<int>(); Node<int> node100 = new Node<int>(100); Node<int> node200 = new Node<int>(200); Node<int> node300 = new Node<int>(300); Assert.AreEqual(0, list.Count); list.AddToTail(node100); Assert.AreEqual(1, list.Count); list.AddToTail(node200); Assert.AreEqual(2, list.Count); list.AddToTail(node300); Assert.AreEqual(3, list.Count); }
public void Have_Ability_To_Remove_Head_Or_Tail_Node() { LinkedList<int> list = new LinkedList<int>(); Node<int> node100 = new Node<int>(100); Node<int> node200 = new Node<int>(200); Node<int> node300 = new Node<int>(300); list.AddToTail(node100); list.AddToTail(node200); list.AddToTail(node300); Assert.AreSame(node100, list.Head); list.RemoveFromHead(); Assert.AreSame(node200, list.Head); Assert.AreSame(node300, list.Tail); list.RemoveFromTail(); Assert.AreSame(node200, list.Tail); }
static void Main(string[] args) { LinkedList<int> list1=new LinkedList<int>(); LinkedList<int> list2 = new LinkedList<int>(); LinkedList<int> list3 = new LinkedList<int>(); list1.value = 1; list1.NextList = list2; list2.value = 2; list2.NextList = list3; list3.value = 3; LinkedList<int>.Print(list1); }
public static void Main() { DataStructures.LinkedList<int> lista = new LinkedList<int>(); lista.AddFirst(10); lista.AddFirst(20); lista.AddLast(30); lista.AddLast(40); lista.RemoveFirst(); lista.RemoveLast(); lista.RemoveFirst(); lista.RemoveFirst(); //lista.printList(); Console.Write("Count: "); Console.Write(lista.Count); Console.Read(); }
public Stack() { list = new LinkedList(); }
public static void TestLinkedList() { LinkedList myLinkedList = new LinkedList(); ListNode head = myLinkedList.CreateLinkedList(new int[] { 1, 2, 3, 4, 5, 6, 7, 8 }); head = myLinkedList.ReverseLinkedList_Iterative(head); head = myLinkedList.ReverseLinkedList_Recursive_TopDown(head); head = myLinkedList.ReverseLinkedList_Recursive_BottomUp(head); ListNode newHead = myLinkedList.DeleteGivenValue_Iterative(head, 2); ListNode nodeDeleted = head.next.next.next.next.next.next.next; myLinkedList.DeleteGivenNode(nodeDeleted); }
public Queue(NodeList node = null) { list = new LinkedList(node); }