Блог пользователя Electro_Valkyrie

Автор Electro_Valkyrie, история, 14 месяцев назад, По-английски

Please share your thoughts

-- Some tips which can help to reduce the constant factor of string match using hashing.

  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится

»
14 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

make your own hashing method, but it can't be less than O(len of string) for each key as you would need to iterate through each letter. I don't think this is what you wanted to know that is to avoid O(length) but I don't think it is possible

  • »
    »
    14 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    I was asking for some type of optimisation we can do by some sort of precomputation or some optimised way of using hashing to check the match between two strings.I know we can't do better than O(n or nlogn) but i get TLE too many times using it even its complexity is not that much, But because of its high constant factor as computation needed for calculating hash is very much costly leading to high constant factor of time complexity.