Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Please answer it by data structures in Python In this problem you will implementa Binary Search Tree. The tree will be storing students information which

Please answer it by data structures in Python
image text in transcribed
In this problem you will implementa Binary Search Tree. The tree will be storing students information which you will insert and delete. You will also implement the inOrder() tree traversal. In addition, you will implement findthallest() which finds the kth smallest node key Implement the following classes 1. class Node that includes Three instance variables private int ID; private double GPA; private Node Left; private Node Right A constructor that initializes the two instance variables ID and GPA Set and get methods for each instance variable .tostring method that returns a string containing the student id. GPA) 2. class Sree that includes Node Root. boolean existint so) boolean exist(Node S. Int id) that chedis whether a node with the same id exists in the BST Tree or not boolean insert(int id, double goa) void insert(Node , Node 5) that inserts a new node into the binary tree. If the student already exists the method will return false, otherwise it will return true afer inserting boolean renove(int ID)that remove the student with the specified ID, the student doesn't exist the method will return false otherwise it will return true vold inder() void in order (Node R) That traverses and prints the contents of the tree in-order according to the ID. (From least to highest int kthSmallest (Node root, int k) that returns the kth smallest node key 3. Write a test application named TestBST. In the main method, do the following Kuwait University College of Engineering and Petroleum CpE-207: Data Structures & Department of Computer Engineering Algorithms Create a BSTree object Display a menu to the user und asking for a choice to be entered. As follows The program can perform the following 1-Insert Students 2. Remove a Student 3- Check it a Students 4- Print Order 5- Find ihmallest 6- Exit Please enter your selection The program will perform the action selected by the user and display a proper message when necessary The program will repeat these actions until the user terminates the program

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions