CST 8130 Data Structures Lab 6 Hashing Algorithms Purpose Demonstrate use of: · Use of good class construction including packages, javadoc & comments and other industry best practices · Use of file...

1 answer below »
Using hash table and use of arraylist or linked list to help with collision



CST 8130 Data Structures Lab 6 Hashing Algorithms Purpose Demonstrate use of: · Use of good class construction including packages, javadoc & comments and other industry best practices · Use of file I/O with secondary storage along with custom-built hash table Task  Read a .csv file, store the data in a hash table, then test it.    ______________________________________________________________________________________________________________   Detailed requirements: · You are provided with a .csv file containing the postal code prefixes for Ottawa and surrounding towns/neighbourhoods in Ontario. · Each line of the file corresponds to one postal code prefix. · There is only 1 field per line. · And you provided with a main() class which opens the .csv file, reads each line and displays it on the “console”. (You can change the main() class). · Your task is to: · Create a class that implements a hash table.  · For your collision resolution strategy choose either “buckets” or “external chaining” · You may use the ArrayList or LinkedList classes from the Java Collections Framework to help implement your collision resolution strategy. · · · The table size must be 25 · The hash table should make use of a generic type  (worth 2 marks out of 10) · · · For your hash function use: int h = key.hashCode(); h = h % tableSize; //tableSize is the size of the table (e.g. 25)         if (h < 0) { h = -h; }               · · input the .csv file · store each of the postal code prefixes in the hash table.  · · · you will need to code a method such as add(key) · test your hash table using a loop and generate 10 random postal code prefixes. determine whether each is present in the hash table or not. · · · the code to generate a random postal code prefix is given to you as part of the starter files.  · you will need to code a method such as contains(key) which returns a boolean   · your output must look like the sample output (screenshot provided on brightspace).  · the actual values may differ, but your output must look like the sample output · hint: use system.out.printf() for all output · 1.     coding requirements:   · · · follow the java coding conventions as your "style guide" · create at least 2 classes · name of the class with the main() method must end in "test" · create at least 2 packages · the main() method should perform all i/o · there is no end-user input, there should only be output · export your eclipse project as a .zip · name your folder using the convention: lab6_firstname_lastname.zip · example: lab6_james_mwangi.zip · similarly, be sure to name your project following the convention:             lab6_firstname_lastname · and submit your solution via brightspace   note: · you will lose marks if you do not: · follow the instructions under detailed requirements · including any api features or algorithms described · meet the coding requirements · ensure there are complete javadoc comments for all public constructors and methods. · produce the same output as the sample output     grading scheme  grading item  marks coding standards: at least classes, at least packages, formatting, naming conventions 2 hashtable class (correct access specifiers, constructors and methods), table size = 25, hash table makes use of a generic type 2 main method performs all file i/o: generates the similar output 2 collision resolution strategy: arraylist or linkedlist used 2 comments (class headers, code comments, javadoc), correctly named submission folders,  able to explain own code 2 total 10    best of luck 0)="" {="" h="-h;" }=""            =""  ="" ·="" ·="" input="" the="" .csv="" file="" ·="" store="" each="" of="" the="" postal="" code="" prefixes="" in="" the="" hash="" table. ="" ·="" ·="" ·="" you="" will="" need="" to="" code="" a="" method="" such="" as="" add(key)="" ·="" test="" your="" hash="" table="" using="" a="" loop="" and="" generate="" 10="" random="" postal="" code="" prefixes.="" determine="" whether="" each="" is="" present="" in="" the="" hash="" table="" or="" not.="" ·="" ·="" ·="" the="" code="" to="" generate="" a="" random="" postal="" code="" prefix="" is="" given="" to="" you="" as="" part="" of="" the="" starter="" files. ="" ·="" you="" will="" need="" to="" code="" a="" method="" such="" as="" contains(key)="" which="" returns="" a="" boolean=""  ="" ·="" your="" output="" must="" look="" like="" the="" sample="" output="" (screenshot="" provided="" on="" brightspace). ="" ·="" the="" actual="" values="" may="" differ,="" but="" your="" output="" must="" look="" like="" the="" sample="" output="" ·="" hint:="" use="" system.out.printf()="" for="" all="" output="" ·="" 1.=""  =""  ="" coding="" requirements:=""  ="" ·="" ·="" ·="" follow="" the="" java="" coding="" conventions="" as="" your="" "style="" guide"="" ·="" create="" at="" least="" 2="" classes="" ·="" name="" of="" the="" class="" with="" the="" main()="" method="" must="" end="" in="" "test"="" ·="" create="" at="" least="" 2="" packages="" ·="" the="" main()="" method="" should="" perform="" all="" i/o="" ·="" there="" is="" no="" end-user="" input,="" there="" should="" only="" be="" output="" ·="" export="" your="" eclipse="" project="" as="" a="" .zip="" ·="" name="" your="" folder="" using="" the="" convention:="" lab6_firstname_lastname.zip="" ·="" example:="" lab6_james_mwangi.zip="" ·="" similarly,="" be="" sure="" to="" name="" your="" project="" following="" the="" convention:=""  =""  =""  =""  =""  =""  ="" lab6_firstname_lastname="" ·="" and="" submit="" your="" solution="" via="" brightspace=""  ="" note:="" ·="" you="" will="" lose="" marks="" if="" you="" do="" not:="" ·="" follow="" the="" instructions="" under="" detailed="" requirements="" ·="" including="" any="" api="" features="" or="" algorithms="" described="" ·="" meet="" the="" coding="" requirements="" ·="" ensure="" there="" are="" complete="" javadoc="" comments="" for="" all="" public="" constructors="" and="" methods.="" ·="" produce="" the="" same="" output="" as="" the="" sample="" output=""  =""  ="" grading="" scheme ="" grading="" item=""  marks="" coding="" standards:="" at="" least="" classes,="" at="" least="" packages,="" formatting,="" naming="" conventions="" 2="" hashtable="" class="" (correct="" access="" specifiers,="" constructors="" and="" methods),="" table="" size="25," hash="" table="" makes="" use="" of="" a="" generic="" type="" 2="" main="" method="" performs="" all="" file="" i/o:="" generates="" the="" similar="" output="" 2="" collision="" resolution="" strategy:="" arraylist="" or="" linkedlist="" used="" 2="" comments="" (class="" headers,="" code="" comments,="" javadoc),="" correctly="" named="" submission="" folders,=""  able="" to="" explain="" own="" code="" 2="" total="" 10=""  =""  best="" of="">
Answered Same DayApr 06, 2022

Answer To: CST 8130 Data Structures Lab 6 Hashing Algorithms Purpose Demonstrate use of: · Use of good class...

Sandeep Kumar answered on Apr 06 2022
102 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here