Beispiel #1
0
        ///<summary>
        ///Print all nodes from start to end.
        ///</summary>
        public void PrintAllNodes(ShaKyList data)
        {
            Console.WriteLine("Head");
            Node curr = data.head;

            while (curr.Next != null)
            {
                curr = curr.Next;
                Console.WriteLine(curr.Value);
            }
            Console.WriteLine("Null");
        }
Beispiel #2
0
        /// <summary>
        /// Prints all nodes in reverse order
        /// </summary>
        public void PrintReverse()
        {
            int  count = 0;
            Node curr  = head;

            ShaKyList reverseList = new ShaKyList();

            while (count < Count)
            {
                if (curr != null && curr.Next != null)
                {
                    curr = curr.Next;
                    reverseList.Add(curr.Value);
                }
                count++;
            }
            reverseList.PrintAllNodes(reverseList);
        }