Binary Search Tree with Duplicates
Specify and implement a class of binary search trees in
which duplicate entries are allowed. Place the duplicate
entry in the entry’s right subtree. Thus, the definition of a
binary search is modified as follows:
For each node in a binary search tree,
Provide a method that searches the tree for a given entry and
returns the first one it finds.
Also, provide a method that returns a list of all entries that
match the given one.
Since the method add does not replace the data, it may
be void. You can either modify the interface or leave it as is and
make add() return null.
Create the binary search tree out of names in the
attached text file “names.txt”. (File is just a list of first and
last names)
Compare entries by last names. For this purpose, create a
class Name which
implements Comparable<Name>, and make the proper
method compareTo().
Output the list of names from the tree in a text file.
Binary Search Tree with Duplicates Specify and implement a class of binary search trees in which duplicate entries are a
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Binary Search Tree with Duplicates Specify and implement a class of binary search trees in which duplicate entries are a
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!