Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN JAVA, Implement an AVL tree-based dictionary. with classes that runs on eclipse methods and main program must all be in JAVA #include #include Dictionary.h

IN JAVA, Implement an AVL tree-based dictionary. with classes that runs on eclipse

image text in transcribedimage text in transcribed

methods and main program must all be in JAVA

#include #include "Dictionary.h" using namespace std; int main(){ Dictionary avl1; // isEmpty: cout Description: Your dictionary class must be called Dictionary. Your dictionary will use an AVL tree to store its contents (words). Each node in the tree will be an object of class WordNode that contains: a word, number of times the word is encountered in the dictionary (let's call it frequency), a boolean variable to support lazy deletion, its height in the tree and links to its left and right childrern The following public methods of Dictionary class must be implemented 1. bool isEmpty() const - returns true if empty, false otherwise 2. int getSize() - returns how many words are stored in the dictionary 3. void insert (String word) insert word into dictionary if it is not already present, otherwise increment the frequency variable for the corresponding word 4. int find(String word) - returns the frequency of the word in the dictionary if the word is present. If the word is not found in the dictionary find returns -1 5. void printSorted() const - prints the words in the tree in lexicographic order 6. void remove (String word) - implements the lazy deletion of a node Lazy deletion: In lazy deletion, instead of deleting the desired node and modifying the structure of the tree, we merely mark the node as deleted. During find operations, we return false if the desired node is found but marked as deleted. This way, the balance of a tree is never disturbed by deletion operations You do not have to implement recycling or garbage collection in this project. Note that once the node is deleted it should not be found via find method or printed by printSorted method

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Data Access Patterns Database Interactions In Object Oriented Applications

Authors: Clifton Nock

1st Edition

0321555627, 978-0321555625

More Books

Students also viewed these Databases questions

Question

What should project managers do to minimize risk?

Answered: 1 week ago

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago