Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

HashEntry.java /* * To change this template, choose Tools | Templates * and open the template in the editor. */ public class HashEntry { private

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

HashEntry.java

/*

* To change this template, choose Tools | Templates

* and open the template in the editor.

*/

public class HashEntry {

private int key;

private String value;

HashEntry(int key, String value) {

this.key = key;

this.value = value;

}

public int getKey() {

return key;

}

public String getValue() {

return value;

}

public void setValue(String val) {

this.value = val;

}

}

HashMap.java

/*

* To change this template, choose Tools | Templates

* and open the template in the editor.

*/

public class HashMap {

private final static int TABLE_SIZE = 137;

HashEntry[] table;

HashMap() {

//Implement

}

public String get(int key) {

// Implement

}

public void put(int key, String value) {

// Implement

}

public void linearProbe(int key, String value){

// Implement

}

public void quadraticProbe(int key, String value){

// Implement

}

}

input.txt

79,,INDIANA LOTTO 93,,treo 700w 123,,Wrsi Riversound cafe cd 161,,Dillons/Kroger Employee Coupon ($1.25 credit) 2140000070,,Rhinestone Watch 2140118461,,"""V"": Breakout/The Deception VHS Tape" 2144209103,VHS,Tintorera - Tiger Shark 2144622711,,Taxi : The Collector's Edition VHS 2147483647,,Toshiba 2805 DVD player 2158242769,288/1.12Z,GREEN SUGAR COOKIES4276 2158561631,,HOT COCOA W/BKMK 2158769549,njhjhn,gjfhjbgkj 2160500567,2.25 oz (64)g,Dollar Bar Rich Raspberry 2172307284,,Mixed seasonal flower bouquet 2177000074,,4 way 13 AMP Extension Lead (Wilkinson UK) 2184000098,21 oz,Christopher's Assorted Fruit Jellies 2187682888,,fairway

upc.csv

79 INDIANA LOTTO
93 treo 700w
123 Wrsi Riversound cafe cd
161 Dillons/Kroger Employee Coupon ($1.25 credit)
178 Outdoor Bag
1090 VAR Rountech Asset 1
1205 1 gal GIANT NATURAL MOUNTAIN SPRING WATER
1243 CVS Photo 1-Hour 4x6 Finishing
1601 Sainsbury's Red Pepper
2288 18 oz Winn Dixie Hand Lotion
2745 sunglasses
4138 100 pack Taiyo-Yuden Value Line 8x DVD-R
4145 7.6 cm x 1.8m Conforming Bandages
5210 maggi
6217 1 gal Trader Joe's 1% Lowfat Milk
7511 44 oz Maverik Plastic Soda Cup
8570 jewerly
9997 32 FL OZ Down to Earth - Goji Berry Juice
10016 16.9 oz Coupon
10023 1.3 - 2.2 oz Coupon
10344 CD WNCI Morning Zoo - Oops... We Did It Again!
14946 6.5mm thick - 3m roll Florist Ribbon - Lemon Yellow
28523 Coupon for $1.00 off Spareribs, Wegmans Rochester
29438 16 FL OZ. (1 pt) 473ML Trader Joe's Energy Drink Wild Berry
40112 Variable Weight Bananas
42215 Small Avacados - Green
43816 1.76 oz Altoids/ Peppermint
46268 JICAMA
49887 1 x 8 oz Coca Cola:Diet Coke
50340 12057 2X72X150 POULTRY NETTING
52559 17.5 oz Raid Ant & Roach Spray
54607 Engizer e2 Batteries
56731 3/8X1.5X48 POINT LATH STAKE
56748 3/8X1.5X48 WD PLASTER LATH
58322 10 oz (284g) Trader Joe's Dark Chocolate Covered Macadamia Nuts
61315 Paper Money-Saving Coupon for Walgreens One-Hour Photo Center; Process 2 rolls, get the 3rd FREE with One Hour Service Any 35 mm film or one-time use camera
61322 Paper Money-Saving Coupon for Walgreens One-Hour Photo Center; Process 1 roll, get the 2nd 50%off with One Hour Service Any 35 mm or one-time use camera
61339 4 Way Smoothing Block Nail Buffer
61537 Park Seeds Tumbling Topm Tomato Seeds, packet of 20
63425 1,5L Sainsbury's HOCK (Deutscher Tafelwein Rhein)
66419 854000 LUMBER CRAYON HOLDER
68529 Gian Eagle $5 Off seafood Purchase
72342 WAVELINE NON/ASBESTOS SHINGLE
72359 STRT EDGE NON ASBESTOS SHINGLE
89906 16 oz (1 lb) 454g Trader Joe's Pacific Northwest Super Sweet Cut White Corn (frozen)
93699 8.fHmg.C3PWDxP6Ca.
94122 7 oz. Original Sesame Thins, Trader Joe's
98601 00414 9GA GALV 50# SMOOTH WIRE
98632 00426 12GA 50# GLV SMOOTH WIRE
98649 00434 14GA 50# GLV SMOOTH WIRE
Use the Java source files HashEntry.java and HashMap.java provided in canvas. Create a hash table that is made of elements HashElement(int Key, String Value) The size of hash table will be 137. Implement the following methods for the hash table: a. put(int Key, String Value): Puts the key value pair in the hash table at a certain index You need to implement a simple hash function H(key)-key mod mapsize to find the index where you will put the pair. 11. iii. If collision occurs, i.e., a pair already exists in that index and the key is not the same as the current key, then you will use this function to resolve the collision, H(key)-(7*H(key)+1) mod mapsize, until you get an empty slot. iv. If the index is already full and the keys are the same, just replace the old value with the new one

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

The Temple Of Django Database Performance

Authors: Andrew Brookins

1st Edition

1734303700, 978-1734303704

More Books

Students also viewed these Databases questions

Question

3. Identify the methods used within each of the three approaches.

Answered: 1 week ago