what is the time complexity of hashing a string? On what things does hashing of string depends?
Time complexity for hashing
@govilayush, it depends on type of hashing you are doing and the length of string , say there is a hashing function like h(s)=s.size()%(tableSize) , here the complexity would be o(1), but it you have a hash function that takes the sum of ascii value of all the characters of the string then such a hash function would result in time complexity of O(n) (n is the string size)
Can u tell that when we use set in python, set uses some inbuild hash function so what is the time complexity of hashing a string in python? assume we have “ASADJA” as string.
i am not sure what python hash function uses but in most of the cases it takes o(n) time where n is the size of key string,