+ 3

How to split string and return the sum of every characters integer to the 31 to the power of i

In a hash table map suppose that key is a pointer of a character char *key, which is a string. Ho do we implement a function that returns split string and return the sum of every characters integer to the 31 to the power of i, where i starts from 0. For example if our char *key="abc"; k1=int(key[0]); k2=int(key[1]); k3=int(key[2]); result=k1+31*k2+k3*31^2; This function should be applied to the char *key="banana"; depending on the length of the characters.

9th Sep 2019, 12:46 PM
Zhenis Otarbay
Zhenis Otarbay - avatar
5 Respuestas
+ 6
~ swim ~ actually I have done it, just I was unsure coz that hashcode only was filling to 2 hasmap lists, i thought it was incorrect ,anyways i will check tomorrow ,thanks
10th Sep 2019, 7:12 PM
Zhenis Otarbay
Zhenis Otarbay - avatar
+ 4
~ swim ~ i meant would you please implementing a function maybe recursive or loop idk
9th Sep 2019, 1:34 PM
Zhenis Otarbay
Zhenis Otarbay - avatar