[X] Tests pass (./test.sh <username> shows no differences between expected and actual outputs)
[X] All formatting changes by the build are committed
[X] Your launch script is named calculate_average_<username>.sh (make sure to match casing of your GH user name) and is executable
[X] Output matches that of calculate_average_baseline.sh
[X] For new entries, or after substantial changes: When implementing custom hash structures, please point to where you deal with hash collisions (method starting at line number 202)
This is an improved version of my previous solution. This time I removed the usage of HashMap and I'm using a two dimensions array to store the stations.
I calculate the hash code of the name and then I apply the modulus to array length to get the bucket to store the station. If there are more than one station on the bucket, I iterate searching for the station with the same name length and hash code.
I'm not sure if this makes the solution potential for hash collisions, but it passes all the tests and the solution matches with the baseline output.
Check List:
./test.sh <username>
shows no differences between expected and actual outputs)calculate_average_<username>.sh
(make sure to match casing of your GH user name) and is executablecalculate_average_baseline.sh
This is an improved version of my previous solution. This time I removed the usage of HashMap and I'm using a two dimensions array to store the stations.
I calculate the hash code of the name and then I apply the modulus to array length to get the bucket to store the station. If there are more than one station on the bucket, I iterate searching for the station with the same name length and hash code.
I'm not sure if this makes the solution potential for hash collisions, but it passes all the tests and the solution matches with the baseline output.
Executed in my laptop: