Bugs fixed on Delete and Insert Methods

This commit is contained in:
2022-03-19 00:00:13 +00:00
parent f2c3e74d15
commit e6557a1d90
3 changed files with 58 additions and 40 deletions

View File

@ -5,7 +5,8 @@ using C_.Datastructures.Nodes;
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
//DoublyLinkedList<int> list = new DoublyLinkedList<int>();
//LinkedList<int> list = new LinkedList<int>();
//list.Append(1);
//list.Append(2);
@ -13,8 +14,25 @@ Console.WriteLine("Hello, World!");
//list.Append(4);
//list.Append(5);
//list.Append(6);
//list.Append(7);
//list.Append(8);
//list.Delete(5);
//list.Delete(2);
//list.Delete(0);
DoublyLinkedList<int> list = new DoublyLinkedList<int>();
list.Append(1);
list.Append(2);
list.Append(3);
list.Append(4);
list.Append(5);
list.Append(6);
list.Delete(5);
list.Delete(3);
list.Delete(0);
//DoublyLinkedList<int> list2 = new DoublyLinkedList<int>();
@ -27,27 +45,9 @@ Console.WriteLine("Hello, World!");
//list2.Append(7);
//list2.Append(8);
//list.Insert(9, 5);
//list.Delete(2);
//var x = list[-6];
//Console.WriteLine(x);
LinkedList<int> list = new LinkedList<int>();
list.Append(1);
list.Append(2);
list.Append(3);
list.Append(4);
list.Append(5);
list.Append(6);
list.Insert(0, 200);
list.Insert(2, 100);
list.Delete(2);
list.Delete(0);
Console.ReadLine();