//Function for traversing tree
 //Searches by: root => left => right
 public void MoviePreOrderTraversal()
 {
     if (root != null)
     {
         root.MoviePreOrderTraversal();
     }
 }
Example #2
0
        //Traversing through the whole tree
        public void MoviePreOrderTraversal()
        {
            //Outputting the current node's movie title
            Console.WriteLine(movie.getTitle());

            //If the left subtree ins't empty, search through it
            if (leftNode != null)
            {
                leftNode.MoviePreOrderTraversal();
            }

            //If the right subtree ins't empty, search through it
            if (rightNode != null)
            {
                rightNode.MoviePreOrderTraversal();
            }
        }