当前位置:天才代写 > C++/C代写,c语言代写代考-100%安全,包过 > CS代写之C++代做Implementation of Hash table with linear probing

CS代写之C++代做Implementation of Hash table with linear probing

2018-05-22 08:00 星期二 所属: C++/C代写,c语言代写代考-100%安全,包过 浏览:800

C++ Implementation of Hash table with linear probing (worth 10%, due June 1st 23:59PM, late submissions will have penalties)

1 Task Description

    You are asked to use C++ to implement

Hash table with linear probing


2 Submission Guideline

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

Your submission should contain exactly one le: main.cpp.

You do not need to submit a design.

You are asked to implement a very speci c 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.

A table slot has three di erent statuses: \never used", \tombstone", and \occupied". Table starts with 26 \never used" slots.

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 nd the key or are certain that the key does not exist in the table.

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 nd an unoccupied slot.

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 nd the key, change the slot status to \tombstone".

You should start your program by initializing an empty hash table. Your program takes one line as input. The input line contains n \modi cation moves" separated by spaces (1 n 26). The available modi cation moves are

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.

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.

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

Sample input 2: Abba Aaaa Acca

Sample output 2: bba aaa cca

Sample input 3: Abba Aaaa Acca Daaa

Sample output 3: bba cca

3 Marking

Marking will be done automatically. The total mark is 10.

9 marks for code correctness: your code will be tested against a set of test cases. 1 mark for compliation.


SVN Instructions

First of all, you need to create a directory under version control:

svn mkdir –parents -m "Creating ADSA Assignment 3 folder" https://version-control.adelaide.edu.au/svn/aXXXXXXX/2018/s1/adsa/assignment3/

aXXXXXXX should be your student ID. The directory path needs to be exactly \2018/s1/adsa/assignmentK", where \K" is the assignment number. To check out a working copy, type

svn checkout https://version-control.adelaide.edu.au/svn/aXXXXXXX/2018/s1/adsa/assignment3/ adsa-18-s1-assignment3/

cd adsa-18-s1-assignment3

svn add main.cpp

Commit the les to SVN:

svn commit -m "Adding ADSA assignment 3 main.cpp"

SVN helps keeping track of le changes (over di erent commits). You should commit your work early and often.


Websubmission

You are asked to submit via the web interface https://cs.adelaide.edu.au/services/websubmission/. The submission steps should be self-explanatory. Simply choose the correct semester, course, and assignment. The websubmission system will automatically fetch the latest version of your work from your SVN repository (you may also choose to submit older versions). Once your work is submitted, the system will launch a script checking the format of your submission. Click \View Feedback" to view the results. Your mark will be calculated o ine after the deadline. You are welcome to resubmit for as many times as you wish (before the deadline).

We will compile your code using g++ -o main.out -std=c++11 -O2 -Wall main.cpp. It is your re-sponsibility to ensure that your code compiles on the university system.1

g++ has too many versions, so being able to compile on your laptop does not guarantee that it compiles on the university system. You are encouraged to debug your code on a lab computer (or use SSH).

代写CS&Finance|建模|代码|系统|报告|考试

编程类:C++,JAVA ,数据库,WEB,Linux,Nodejs,JSP,Html,Prolog,Python,Haskell,hadoop算法,系统 机器学习

金融类统计,计量,风险投资,金融工程,R语言,Python语言,Matlab,建立模型,数据分析,数据处理

服务类:Lab/Assignment/Project/Course/Qzui/Midterm/Final/Exam/Test帮助代写代考辅导

天才写手,代写CS,代写finance,代写statistics,考试助攻

E-mail:850190831@qq.com   微信:BadGeniuscs  工作时间:无休息工作日-早上8点到凌晨3点


如果您用的手机请先保存二维码到手机里面,识别图中二维码。如果用电脑,直接掏出手机果断扫描。

qr.png


 

    关键字:

天才代写-代写联系方式