Question: In Java, implement a heap class that is generic. The main important part of this heap is the following: a) The heap will allow for

In Java, implement a heap class that is generic. The main important part of this heap is the following:

a) The heap will allow for the storing of multiples of the same value.

b) The heap will be a min-heap, which means minimum will be at the top.

The heap itself should contain the following:

-an array based implementation including a way to keep track of any duplicates that are added to the heap

-appropriate constructors

-add and remove methods for individual nodes in the heap

-a method to return the number of occurrences of particular data element

-any other helper methods or methods required to complete the task described below

The task follows:

Write a GUI TESTER class that allows users to enter words one at a time or to read from a file. These processes should not be mutually exclusive, meaning that a user could do both read from a file and then add more words. The GUI should also allow a user to search for a word (and report its presence and the number of occurrences), delete a word (one occurrence or all occurrences at once) and traverse the heap one element at a time using a pre-order traversal. There should also be a mechanism to output the heap to a new output file. The output file contains word-number pairs which indicate the word and the number of occurrences in alphabetical order. (Hint: Make a copy of the heap and destroy it one element at a time, knowing that the smallest element is always at the top.)

***Please ensure you create a GUI class.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!