Beispiel #1
0
        private static void testSinglyLinkedList()
        {
            var _singlylinkedlist = new SinglyLinkedList <int>();

            _singlylinkedlist.AddTheEnd(666);
            for (int i = 0; i < 100; i++)
            {
                _singlylinkedlist.Insert(i, i);
            }

            Console.WriteLine(_singlylinkedlist.ToString());
            _singlylinkedlist.Insert(1314, 0);
            _singlylinkedlist.Insert(3344, 1);
            _singlylinkedlist.Insert(6666, 5);
            _singlylinkedlist.AddTheEnd(888);
            Console.WriteLine(_singlylinkedlist.ToString());
            _singlylinkedlist.Remove(0);
            _singlylinkedlist.Remove(3);
            Console.WriteLine(_singlylinkedlist.ToString());
            _singlylinkedlist.Update(111111, 0);
            _singlylinkedlist.Update(111111, _singlylinkedlist.Count - 1);
            Console.WriteLine(_singlylinkedlist.ToString());
            foreach (var item in _singlylinkedlist)
            {
                Console.WriteLine(item);
            }
        }