/// <summary>
 /// Returnerar en lista med alla värden i sökträdet i inorder.
 /// </summary>
 public IEnumerable <T> Inorder()
 {
     if (_root != null)
     {
         return(_root.Inorder());
     }
     else
     {
         return(new List <T>());
     }
 }
Esempio n. 2
0
        //Traverseringsmetoder
        public IEnumerable <T> Inorder()
        {
            List <T> InList = new List <T>();

            if (_value != null)
            {
                if (_leftChild != null)
                {
                    InList.AddRange(_leftChild.Inorder());
                }

                InList.Add(_value);

                if (_rightChild != null)
                {
                    InList.AddRange(_rightChild.Inorder());
                }
            }
            return(InList);
        }