1. Homepage
  2. Programming
  3. COMP SCI 2201 Algorithm and Data Structure Analysis - Assignment 3: C++ Implementation of Hash table with linear probing

COMP SCI 2201 Algorithm and Data Structure Analysis - Assignment 3: C++ Implementation of Hash table with linear probing

Engage in a Conversation
AustraliaUniversity of AdelaideCOMP SCI 2201COMPSCI2201Algorithm and Data Structure AnalysisHash TableC++CS220

C++ Implementation of Hash table with linear probing CourseNana.COM

1 Task Description CourseNana.COM

You are asked to use C++ to implement CourseNana.COM

Hash table with linear probing CourseNana.COM

2 Submission Guideline CourseNana.COM

You must follow this guideline! Your submission will be marked automatically. Failure to follow this guideline will result in 0. CourseNana.COM

Your submission should contain exactly one file: main.cpp.
You do not need to submit a design.
You are asked to implement a very specific hash table. The keys are lower-case English words (e.g., apple,
 pear). The length of a key is at most 10. The hash function is “simply using the last character”. That is, the hash value of apple should be e, and the hash value of pear should be r. Your hash table contains exactly 26 slots (hash value a to hash value z). The total number of English words/keys you need to deal with is at most 26, so the table is never too small. CourseNana.COM

A table slot has three different statuses: “never used”, “tombstone”, and “occupied”. Table starts with 26 “never used” slots. CourseNana.COM

Searching works as follows: given a key, take its last character as the hash value. First try the corre- sponding table slot, if the objective key is there, then you have found it. If the corresponding slot is never used, terminate because we are certain that the objective is not in the table. If the slot is occupied but it’s not the objective, or the slot is a “tombstone”, then we move on to the next slot (may need to wrap around the table if the current slot is the last one). We keep trying until we either find the key or are certain that the key does not exist in the table. CourseNana.COM

Insertion works as follows: First perform searching to ensure that the key does not exist. If it already exists, then do nothing. If it does not, take the last character of a key as the hash value. If the corresponding table slot is not occupied (either “never used” or “tombstone”), put the key there (the slot is now occupied). If the corresponding slot is already occupied, try the next slot. Repeat trying until you find an unoccupied slot. CourseNana.COM

Deletion works as follows: given a key, use the searching process to locate its slot. (If the key is not in the table, then do nothing.) Once you find the key, change the slot status to “tombstone”. CourseNana.COM

You should start your program by initializing an empty hash table. Your program takes one line as input. The input line contains n “modification moves” separated by spaces (1 n 26). The available modification moves are CourseNana.COM

AWord (Character A followed by a lower-case English word of length at most 10): Aapple means insert key apple into the hash table. If apple is already in the table, do nothing. CourseNana.COM

DWord (Character D followed by a lower-case English word of length at most 10): Dapple means delete key apple from the hash table. If apple is not in the tree, do nothing. CourseNana.COM


CourseNana.COM

At the end, you need to go through the slots from a to z, and output all the keys separated by space. You don’t need to worry about invalid inputs.
Sample input 1:
Aaaa Accc Abbb
Sample output 1: aaa bbb ccc CourseNana.COM

Sample input 2: Abba Aaaa Acca Sample output 2: bba aaa cca
Sample input 3: Abba Aaaa Acca Daaa Sample output 3: bba cca CourseNana.COM

3 Marking CourseNana.COM

Marking will be done automatically. The total mark is 10 (1 for compiling and 9 for 9 test cases). CourseNana.COM

4 Websubmission CourseNana.COM


CourseNana.COM

We will compile your code using g++ -o main.out -std=c++11 -O2 -Wall main.cpp CourseNana.COM

  CourseNana.COM

Get in Touch with Our Experts

WeChat (微信) WeChat (微信)
Whatsapp WhatsApp
Australia代写,University of Adelaide代写,COMP SCI 2201代写,COMPSCI2201代写,Algorithm and Data Structure Analysis代写,Hash Table代写,C++代写,CS220代写,Australia代编,University of Adelaide代编,COMP SCI 2201代编,COMPSCI2201代编,Algorithm and Data Structure Analysis代编,Hash Table代编,C++代编,CS220代编,Australia代考,University of Adelaide代考,COMP SCI 2201代考,COMPSCI2201代考,Algorithm and Data Structure Analysis代考,Hash Table代考,C++代考,CS220代考,Australiahelp,University of Adelaidehelp,COMP SCI 2201help,COMPSCI2201help,Algorithm and Data Structure Analysishelp,Hash Tablehelp,C++help,CS220help,Australia作业代写,University of Adelaide作业代写,COMP SCI 2201作业代写,COMPSCI2201作业代写,Algorithm and Data Structure Analysis作业代写,Hash Table作业代写,C++作业代写,CS220作业代写,Australia编程代写,University of Adelaide编程代写,COMP SCI 2201编程代写,COMPSCI2201编程代写,Algorithm and Data Structure Analysis编程代写,Hash Table编程代写,C++编程代写,CS220编程代写,Australiaprogramming help,University of Adelaideprogramming help,COMP SCI 2201programming help,COMPSCI2201programming help,Algorithm and Data Structure Analysisprogramming help,Hash Tableprogramming help,C++programming help,CS220programming help,Australiaassignment help,University of Adelaideassignment help,COMP SCI 2201assignment help,COMPSCI2201assignment help,Algorithm and Data Structure Analysisassignment help,Hash Tableassignment help,C++assignment help,CS220assignment help,Australiasolution,University of Adelaidesolution,COMP SCI 2201solution,COMPSCI2201solution,Algorithm and Data Structure Analysissolution,Hash Tablesolution,C++solution,CS220solution,