Section 10.6 Binary Search Tree Exercise
Subsection 10.6.1 Goals
The purpose of this assignment is to learn to
- Access remote data through BRIDGES.
- Manipulate a binary search tree using the earthquake magnitude (or some other attribute) as a search key
- Traverse BST using different methods.
Subsection 10.6.2 Programming Tasks
Starting file: BST_eq.java 1
Build a binary search tree where each node represents an earthquake record
Steps:
- Open your base code.
- Plug in your credentials.
- Complete the insert_R() function to recursively insert objects into the binary search tree. You should insert objects based on the magnitude of the earthquake.
- Perform a traversal on the completed BST.
- Perform a binary search to find the biggest earthquake based on magnitude and color it red.
Subsection 10.6.3 Building The BST
- Your BSTElement will use EarthquakeUSGS as the generic parameter, using Double as the key type. The key is will be the magnitude of the earthquake.
- Write an insert() method, creating and inserting earthquake records into a binary search tree, using the magnitude of the quake as a search key. Color the nodes less than 3.0 magnitude orange and the nodes greater than or equal to 3.0 magnitude green (10 points)
- Color the root node in a unique color. (done for you)
- Perform a traversal of the tree and color leaf nodes black. (10 points)
- Traverse the tree to find the largest quake and style it RED. (5 points)
- Once completed, submit your code and link to the visualization. (2 points)
You have attempted of activities on this page.
uncc.instructure.com/courses/16965/files/21470633?wrap=1