//Function for listing top ten most borrowed movies
        public void TopTen(MovieCollection movieCollection)
        {
            //If the root node is not null
            if (root != null)
            {
                //Setting the topTenMovies array to null
                topTenMovies = null;

                //Getting an array of each of the movies
                root.TopTen(movieCollection);

                //Sorting the borrowed array into descending order by number of times borrowed
                BubbleSort(topTenMovies);
            }
        }
예제 #2
0
        //Function for getting the top ten borrowed movies
        public void TopTen(MovieCollection movieCollection)
        {
            //Adding the current movie node to the borrowed array
            movieCollection.AddToBorrow(movie);

            //If the left subtree isn't empty, search through it
            if (leftNode != null)
            {
                //Searching the left subtree
                leftNode.TopTen(movieCollection);
            }

            //If the right subtree isn't empty, search through it
            if (rightNode != null)
            {
                //Searching the right subtree
                rightNode.TopTen(movieCollection);
            }
        }