Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

After completing this assignment, you will be able to: Use an algorithmic planning document to plan your ADT Create test cases to test the ADT

After completing this assignment, you will be able to:
Use an algorithmic planning document to plan your ADT
Create test cases to test the ADT
Write a class to represent a Table ADT using a hash table as the data structure
Write a client (tester) menu-driven program to test your ADT
Requirements
Computer science vocabulary is important with moving on to the next level of courses. For this assignment, you will build a dictionary to store computer science terms and definitions.
ADT requirements
Table Implementation (Dictionary):
Use a hash table for storing data in the dictionary. Make sure your hash tables size is a prime number. The search key will be the name of the computer science term.
The ADT will contain the following functions:
Constructor - is passed the size of the table and dynamically allocates the table. For this, you will need to use a pointer to a pointer, table is a pointer to Node pointers:
Node** table = new Node*[size];
Hash function - generates a hash code based on the computer science term
Add term - is passed a term and a description. Do not add duplicate terms; if the term is a duplicate, return a flag and print a message in the client program
Display definition - is passed a term and displays the definition if it exists
Display dictionary - displays the terms stored in the hash table, print each index, and then the words stored in the chain on that index, for example:
Index 0:
Index 2:
Index 3: [hash table][function]
Index 4: [modulus]
Remove computer science term - is passed a term and removes the node, if it exists. Return a flag and print a message in the client program if the term does not exist.
Destructor
Experiment with different table sizes and hash algorithms. Try using a table size with a power of 2 instead of a prime number. How does that affect the distribution of your data?
Input file:
Create an input text file and add at least 100 computer science terms and definitions.
Use only terms youve used in CS161, CS162 and CS163!
Your file should be of the format:
term|definition|
Client requirements
Read from the text file the 100 terms and definitions to populate the hash table. After your text file has been approved, I recommend combining a few files from other students to create a LARGE dataset.
Create a menu system that allows the user to:
Add new terms to the dictionary - print a message if the term was successfully added or if the term (case insensitive) already exists
Search for a term and print the definition
Display the hash table
Remove a term from the dictionary
Instructions

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_2

Step: 3

blur-text-image_3

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

Modern Database Management

Authors: Heikki Topi, Jeffrey A Hoffer, Ramesh Venkataraman

13th Edition

0134773659, 978-0134773650

More Books

Students also viewed these Databases questions