the hash function is given. So i just pass my array into it and take the hash array. But then how do i print it?
How to approach the problem
use a hashmap where the key is the values present in array A and the corresponding values are the hashes. Then print
that will be returned from the funciton present. But how do i print it?is my question
use a for loop over the hashmap keys to print the values corresponding to the keys
can you give me the complete code ?I am not following. Hashmap here is an array
that is what you have to change. You dont have to make hash[] array but a hashmap.
for(key : keySet){ //key set of hashmap
print(hashmap.getValue(key)); //get the value corresponding to the key
}
here keys are the input from the array A and values are the hashes of the keys