Rolling Hash - CP TacTics | Rabin-Karp Algorithm for Pattern Searching | The Code Mate

Competitive Programming TacTics#4
Rolling Hash: In this Session, I have explained the Rolling Hash [Rabin Karp Algorithm] technique which is the optimal way to solve problems related to Pattern Matching. We also explored different ways to form a hash function to reduce the overall time complexity.
There are many problems that can be solved with the rolling hash tactic, It can reduce your time complexities, Below are the few problems on the rolling hash.
LeetCode
leetcode.com/problems/distinc...
leetcode.com/problems/longest...
🔥 DONT CLICK THIS: bit.ly/2BEDWYG
🎬 CP TacTics Playlist: • Competitive Programmin...
👍 Let's Connect on Facebook : bit.ly/31KPcgI
🔗 Share with your network : • Rolling Hash - CP TacT...
💡 Source code:github.com/naval41/CS_Tricks/...
📲 Connect on Telegram : t.me/joinchat/Kc_ZkBsijqXJDWr...
Note : Problems rights reserved by LeetCode.
#rollinghash #rabinkarpalgorithm #cptictacs #programming #dataStructures #algorithms #coding #competitiveprogramming #google #java #codinginterview #problemsolving #facebook #amazon #oracle #linkedin

Пікірлер: 9

  • @AnuragKumar-cb5lr
    @AnuragKumar-cb5lr3 жыл бұрын

    Oh! Nice explanation. Thank You

  • @thecodemate7048

    @thecodemate7048

    3 жыл бұрын

    Glad that you like it.

  • @mayank80862
    @mayank808623 жыл бұрын

    Good one 👍!!! What would be the value of "h" here.

  • @thecodemate7048

    @thecodemate7048

    3 жыл бұрын

    Thanks Mayank, Value of h is Math.pow(d,M-1)%q, You can check the source code link from the description.

  • @kalpakHere
    @kalpakHere3 жыл бұрын

    Thanks for the explanation. Really verbose. A few things though : 1. I get a compiler error for int h = (int) (Math.pow(d,M-1)%q); which basically resolves to typecasting. And, on typecasting it to int, the code isnt working. Can you please take a look into it.

  • @Xd-dw7oe

    @Xd-dw7oe

    2 жыл бұрын

    same problem

  • @pandit-jee-bihar
    @pandit-jee-bihar2 жыл бұрын

    Where have you declared 'd' in your code.

  • @rakshitpuri4192

    @rakshitpuri4192

    2 жыл бұрын

    Line 4