Menu

(Solved) : Generate Function Int Hash String Id Return Unique Value 0 159 999 Possible Id May Assume Q33346313 . . .

Generate a function int hash(string ID); thatreturn a unique value between 0 and 159,999 for each possible ID.You may assume that all IDs are of length six. Also, the first twocharacters are always either ‘A’ or ‘B’ or ‘C’ or ‘D” and the lastfour characters are always digits (‘0’ through ‘9’). That meansthere are 160,000 possible ID’s.

Hint: generate a number between 0 and 15 for the first twocharacters (e.g. AA –> 0, AB –> 1 etc) and a number between0 and 9999 for the four digits (easy) and then multiply the firstnumber by something and add the second number to get your returnvalue.

Expert Answer


Answer to Generate Function Int Hash String Id Return Unique Value 0 159 999 Possible Id May Assume Q33346313 . . .

OR