Skip to content

KhaledEkramy/Java-Binary-Search-Tree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java-Binary-Search-Tree

Introduction Write java code to create "Student" class that contain name, ID, and numeric grade attributes. You may use the ID or the grade as a key. You may add more attributes when necessary (e,g student object when creating binary trees). Your program must define a java application (main method to test your work). Your program must be able to count the number of comparisons and. Swaps in each algorithm. As a testing data you may enter about 20 students' data. The evaluation of the projects will focus on free of errors running programs. Methods : Consider a BST (binary search tree) data structure. Write java implementation for the following methods. Use students class as explained above. A recursive int height() method which returns the height of the tree. If the tree is empty, return -1. The recursion will happen in the BinaryNode class in this method and others. A recursive int size() method which returns the number of elements in the tree. A recursive boolean containsNonBST(item) method that returns true if and only if the item is in the tree. • A boolean isEmpty() method, which returns true if the tree is empty and false otherwise. A recursive String toString() method which returns a String containing the elements of the tree. An ArrayList toArrayList() method which returns an ArrayList of the elements in-order.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages