/// <summary>
 /// Returnerar en lista med alla värden i sökträdet i postorder.
 /// </summary>
 public IEnumerable <T> Postorder()
 {
     if (_root != null)
     {
         return(_root.Postorder());
     }
     else
     {
         return(new List <T>());
     }
 }
예제 #2
0
        public IEnumerable <T> Postorder()
        {
            List <T> PostList = new List <T>();

            if (_value != null)
            {
                if (_leftChild != null)
                {
                    PostList.AddRange(_leftChild.Postorder());
                }
                if (_rightChild != null)
                {
                    PostList.AddRange(_rightChild.Postorder());
                }

                PostList.Add(_value);
            }
            return(PostList);
        }