Given below is a hash function.
Juniper Networks technical mcq question, verified with a worked answer. Free to practise - no sign-up.
Given below is a hash function. Which of the following pairs will have the same hash value?
Choose all that apply.
hashFunction(string s) {
int hash = 0;
for(int i=0;i<s.length;i++) {
hash += (182)*((i+1)*(s[i]-'a'+1));
}
return hash;
}
Example
s = "abeaa"
hash = 111 + 022 + 135 + 041 + 151 = 21
Pick ONE OR MORE options
Show answer & explanation
Answer: A. A) "veoyiwz" and "qtmzmzwu"
Accurate technical and quantitative evaluation based on foundational principles.
Step-by-step Derivation:
Step 1: Formulate problem conditions.
Step 2: Apply logical deduction.
Step 3: Conclude correct option.