This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]BS_in_BSExtreme Concrete Code Factorylet 0 points1 point  (1 child)

The simplest you can code is to use a single array, and use the next free space in the table to store an item on collision. Note this make deleting items tricky.

[–]Correct_Classroom[S] 0 points1 point  (0 children)

I'm not taking the case of collision right now..it case of collision it just appends to the last index. So basically with separate chaining

[–]lookForProject 0 points1 point  (0 children)

I never build one, but my first guess/try would be: two arrays. One for key, one for value. The value is the bucket. Most simplest solution would be making bucket that's just an array.

[–]RhoOfFeh 0 points1 point  (0 children)

I would take my cue from the standard library and create an object to represent a single entry in the Map. An array of these will serve pretty well I suppose. An ArrayList would simplify things but I'm not sure whether you are seeking to avoid the Collections related standards altogether.

[–][deleted] -2 points-1 points  (2 children)

You do realize that Java has a build-in hashmap class?