Rolling hash | Rabin karp algorithm | Pattern searching

Поділитися
Вставка
  • Опубліковано 11 жов 2024
  • This video explains the rolling hash technique with the help of rabin karp algorithm which is used for searching a given pattern in text. I have explained both rabin karp algorithm as well as rolling hash by taking suitable examples. I have shown how to create a stronger hash in order to match pattern in given text efficiently. This is a very frequently asked interview question as well as a frequently faced question in the coding round as well. CODE LINK for rabin karp algorithm is present below. If you find any difficulty or have any query then do COMMENT below. PLEASE help our channel by SUBSCRIBING and LIKE our video if you found it helpful...CYA :)
    CODE LINK: gist.github.co...

КОМЕНТАРІ • 191

  • @sorinnorris
    @sorinnorris 4 роки тому +354

    For every confusing topic in a textbook or a course, there is a video by an Indian guy on UA-cam explaining it much more clearly. You sir, are a legend.

    • @techdose4u
      @techdose4u  4 роки тому +43

      🤣 Thanks

    • @khushbuchoudhary5185
      @khushbuchoudhary5185 2 роки тому +1

      Hilarious!

    • @souravbhagat1358
      @souravbhagat1358 8 місяців тому

      ​@@techdose4u Pls make a vedio on Approximation Algorithm. And it's various Types..pls bana dhijye khi nhi available hai

    • @ytg6663
      @ytg6663 6 днів тому

      And then there are the guys who troll indian

  • @avijitdey992
    @avijitdey992 3 дні тому

    no bhaiya didi bs, no time wasting, no overexplaining.
    short and concise, to the point video.
    Love you videos, perfect for an individual who values time.

  • @Oscar-vr2md
    @Oscar-vr2md 4 роки тому +40

    Coming from day 21 may challenge. He referred me to this video for rolling has. Now he referring to another video. He truly is a programmer!

    • @techdose4u
      @techdose4u  4 роки тому +3

      🤣 hahahaaa

    • @ragingpahadi
      @ragingpahadi 4 роки тому +9

      He is using rolling technique :p

    • @AyushMo
      @AyushMo 3 роки тому

      Who is the 'he' y'all are talking about?

    • @rohansamanta7819
      @rohansamanta7819 3 роки тому +1

      @@AyushMo The channel they mean. In other videos, he has asked his viewers to also refer to this video.

    • @AyushMo
      @AyushMo 3 роки тому +1

      @@rohansamanta7819 ah okay, thanks

  • @kashish322
    @kashish322 3 роки тому +31

    okay the rap in the end was icing on the cake, the explanation was clear, concise and to the point.

  • @deepaligarg2978
    @deepaligarg2978 2 роки тому +3

    If I see a video by you, I heave a sigh of relief because I know that it will be superbly explained and that I need to look no further.

  • @ayushgarg5929
    @ayushgarg5929 4 роки тому +11

    sir i have been continuously watching you videos. since then , i started loving programming ...a very big thumbs up

    • @techdose4u
      @techdose4u  4 роки тому +3

      Thanks :) Recommend your friends if possible as well.

    • @ayushgarg5929
      @ayushgarg5929 4 роки тому +1

      sir , does there no such hash function exists so that no collision occur as well as the size limit also not exceeds ?

    • @techdose4u
      @techdose4u  4 роки тому +3

      We can implement hash using trie. That will be very simple. If you don't want collision then take larger hash size. If size is limited then resolve collision by linked list at each node. You can also use trie for hash implementation. Will put a video in future for it as well.

  • @pratikmhatre4815
    @pratikmhatre4815 Рік тому +1

    When it comes to learning new algorithm, I first check if Tech Dose has any video related to it, if its there then it becomes my first choice automatically

  • @zabadibzabzab1
    @zabadibzabzab1 Рік тому +2

    i was surching for a tutorial on how to roll hash joints but i watched the whole video in the end

  • @meghasharma3092
    @meghasharma3092 4 роки тому +6

    what a great job you are doing for programming community !!

  • @rahulsingh40g
    @rahulsingh40g 3 роки тому +3

    starting with trivial approach was a really nice move.

  • @anishashruti
    @anishashruti 3 роки тому +7

    how do they even come up with such algorithms!!
    Really amazing explanation, Thanks a lot

  • @dushsam
    @dushsam 2 роки тому

    You are my number 1 youtuber on algorithms and dsa. You simplify life sir

  • @ajaywadhwa3398
    @ajaywadhwa3398 3 роки тому +2

    Wah Wah Wah !!!!! No words to express feelings. Really Awesome

  • @yusufahmed2233
    @yusufahmed2233 4 роки тому +4

    Thank you very much sir for saving me hours of pain and frustration

  • @willturner3440
    @willturner3440 3 роки тому +2

    Why UA-cam provide only 1 like button 😞....
    btw best channel for placements🤗

  • @tanned_cosines_
    @tanned_cosines_ 3 роки тому +1

    bhaisahab tumhare hash function ne to dimaag hi uuda diya bhaiiiiii
    galat kehl gaye vro app to
    i never thought of taking modulus at every addition, demmmm
    kryptologisht101 :D :]

  • @TheDeepsz
    @TheDeepsz 3 роки тому +2

    I understand that in order to make sure that the hash function strong, we need to factor in the position of the alphabet in the pattern, instead of taking base value as the alphabet size =26, can we consider the size of the pattern itself, like for e.g. for pattern BAA, pattern size is 3, and the hash will be 2*(3^2) + 1*(3^1) + 1*(3^0)

  • @renon3359
    @renon3359 3 роки тому +1

    For every DSA problem, there is a solution video by Tech dose. 🙏🏾🙏🏾🙏🏾🙏🏾🙏🏾🙏🏾🙏🏾🙏🏾🙏🏾🙏🏾

  • @utoob3004
    @utoob3004 Рік тому

    This is a very nice explanation which helped me understand the benefit of a rolling hash (reusing the parts of the window you already calculated), and how to generate a stronger hash.
    One minor comment: I don't think it is technically correct, in the case of base 26, to say you are shifting "bits". A bit is a binary digit, which by definition is base 2. You can just say "shift . . . by one digit".
    In fact, to encode something with 26 characters, you'd need at least 5 bits per character. Thus, you need to shift at least 5 bits, each time. 🙂

  • @elevatedemotions4548
    @elevatedemotions4548 2 роки тому

    I'm trying to roll hash for smoking but I still watched anyway 💯

  • @navendraagrawal
    @navendraagrawal 2 роки тому +1

    Excellent explanation. No one explained the algorithm better than you. Good job

  • @nikhilraiStandup
    @nikhilraiStandup 4 роки тому +6

    Concise and Exact explanation.Thank you.

  • @explorewithshobhit9157
    @explorewithshobhit9157 2 роки тому

    Communication skills are very Good 🔥👍

  • @arpitmani6553
    @arpitmani6553 3 роки тому +1

    You are my hero...........best explanation

  • @surenderthakran6622
    @surenderthakran6622 3 роки тому +3

    I don't understand why at 11:05 we are subtracting only (1 * 26^2)%p ? While creating hash for the 3 character long window we added it with two other characters' hash but after each addition we modded the result with p. i.e. hash[A] = (1 * 26^2)%p; hash[AA] = (hash[A] + 1*26^2)%p; hash[AAB] = (hash[AA] + 2*26^2)%p. The value of hash[A] has been modded twice in the final hash so how come while removing it we subtract it without any consideration for the mods. i.e. how come hash[AB] = hash[AAB] - hash[A] ? Shouldn't the double modding come into the equation somewhere?

  • @anuj654
    @anuj654 4 роки тому +3

    Bhaiya ur videos r very helpful
    Please upload more videos

  • @shishpalvishnoi7974
    @shishpalvishnoi7974 4 роки тому +2

    Hello guy's welcome back to tech dose and in this video we will discuss.......so let's look at problem statement.... 🤣 🤣 🤣

    • @techdose4u
      @techdose4u  4 роки тому

      These are my goto lines 😂

  • @KushalBhatia
    @KushalBhatia 2 роки тому +1

    Superb explaination.

  • @sharinganuser1539
    @sharinganuser1539 4 роки тому +2

    there are many things to remember in this ....1) collision(for X1 ,X2 if h(X1)==h(X2) and X1!=X2) , collision frequency 1/p where p is some big prime number . 2) an interesting mod property we r using here i.e for a[1......n] there exist a^-1[1......n] such that a*b*a^-1= b mod p, where p is some prime number .
    ALGO: (general)
    our class has 3 funnction
    1. hash() -> return Hk;
    2. pop()-> pop last value;
    3. append() -> append new value;
    constructor() -> take base , p {base in our case 26 , prime number p}
    basic opperation including append and pop() // its intuitive...
    Hw= (n-old*base^size-1)*base +new
    __init__(base ,p){
    hash=0;
    constant=1 // constant= base^size mod p
    }
    append(new ){
    hash= (hash*base + new ) mod p;
    constant= (constant*base ) mod p;
    }
    pop(old){
    hash=(hash- old*constant + old*p ) mod p // old*p is correction factor since hash-old*constant

  • @suprithhattikal3639
    @suprithhattikal3639 Рік тому

    Precise explanation.

  • @lambar0
    @lambar0 Рік тому +2

    Helps develop good intuition …

  • @islammurtazaev4891
    @islammurtazaev4891 2 роки тому

    The explanation I found so far

  • @harshkumarsharma6863
    @harshkumarsharma6863 3 роки тому

    Beautifully Explained

  • @fatihguven7328
    @fatihguven7328 Місяць тому

    Thanks mate! That's great explanation!

  • @vishalrao3529
    @vishalrao3529 4 роки тому +1

    very nice and complete explanation!!!!keep making such videos

    • @techdose4u
      @techdose4u  4 роки тому

      Sure :)

    • @vishalrao3529
      @vishalrao3529 4 роки тому

      @@techdose4u i am implementing my own code as per your video but getting integer overflow at one place despite using mod operator!!! If i share my code will you be able to help?? It will be highly appreciated

  • @AKASHKUMAR-bf7co
    @AKASHKUMAR-bf7co Рік тому

    it seems to be quite easier than it look like.

  • @viratkohli-jr6md
    @viratkohli-jr6md 3 роки тому +2

    the video was very helpful, thankyou for saving my time.

  • @raakobihai2967
    @raakobihai2967 4 роки тому +3

    I really love your video, it really helped me understand!!

  • @hardikgupta4038
    @hardikgupta4038 3 роки тому +5

    While subtracting (11:08 min), shouldn't we subtract 1x26^2%p, we only subtracted 1x26^2, is this correct?

    • @amitavamozumder73
      @amitavamozumder73 3 роки тому

      since 26^2 is already lower than 5381, so he didn't bother, but yeah in code you have to.

  • @wasayhusain509
    @wasayhusain509 Рік тому

    Amazing explanation

  • @shashikant3746
    @shashikant3746 3 роки тому +2

    thank you for this beautiful explanation. sir, you are gain new subscribe...

  • @mahipalsingh-yo4jt
    @mahipalsingh-yo4jt 3 роки тому +1

    Great explanation sir!!!!!!!!!!!!!!!!!

  • @sharad3877
    @sharad3877 Рік тому

    Awesome Explaination....can you please provide the code also for the above, the link you have given in description redirects to the GFG solution which is quite confusing

  • @ayodejiakinola7343
    @ayodejiakinola7343 3 роки тому +1

    The best explanation.. Thank you

  • @radhasingh3549
    @radhasingh3549 2 роки тому

    Thanks a lot for the video!

  • @yashSharma-pe1dp
    @yashSharma-pe1dp 3 роки тому

    Bhaiya after the hash improvement , why the worst case t.c is O(N.m)
    Because we atmost have to search for O(N - L +1) bcs we don't have to compare the pattern bcs we will be having the different ans for diff. Pattern and when the hash ans matches then we can guarantee that the pattern is exactly same , and in the constant time we are able to find the hash value , then it should be O(N -M +1) time.

  • @akhilesh59
    @akhilesh59 2 роки тому

    Very Nice Explanation. Thank you :)

  • @muskangupta5873
    @muskangupta5873 2 роки тому

    thanks for making these videos😇

  • @laraibanwar1618
    @laraibanwar1618 3 роки тому +1

    The code which u have provided is from gfg right... But still the explanation was great

    • @techdose4u
      @techdose4u  3 роки тому

      Yes. Even if I would have written, the code would have been the same 😅

  • @AnkushKumar-mk8ns
    @AnkushKumar-mk8ns 3 роки тому +1

    I am not able to understand the code given in description,
    does the code vary from given hash formula and if it is then what formula has been used in the code.
    please help.

  • @tushankpanchal0464
    @tushankpanchal0464 3 роки тому

    what is the use of rabin karp Algo..when we have to compare letters again(in the code that you provide)?
    and when i tried to solve this by your method ...that you've explained...it's giving me negative values for text hash value

  • @kajalpareek8291
    @kajalpareek8291 4 роки тому +1

    very nice explanation
    try to explain algo also in video..keep up with good work

  • @devanathanng4494
    @devanathanng4494 4 роки тому +1

    This is brilliant!

  • @worldofafrontenddeveloper9187
    @worldofafrontenddeveloper9187 3 роки тому +1

    First of all big thanks for making these videos, you are doing a great job!
    I have a question , I am kind of beginner, so please correct me if I am wrong.
    For this pattern matching brute force approach , instead of matching all the substrings of the window size ( size of pattern string) , if I first check if the first character of the pattern string is same as the first character of the current substring of text , and then do the matching operation , I will not really compare with all the substrings. Will the time complexity still be o(n m ) ? If so, is that the case when will not find any substring?

    • @Harry-ko6ws
      @Harry-ko6ws Рік тому

      Late reply, but in case you still need an answer.
      Yes, the time complexity still be O(n*m) in worst case like no substring were found of the matching is in the last position. But in real practice, it may perform just a little bit better than the brute force approach, and even not as effective as the basic hashing formula in rolling hash

  • @rite2riddhi
    @rite2riddhi 4 роки тому +1

    Hi....what if we use a hashing function like we convert the pattern into its corresponding decimal number

    • @techdose4u
      @techdose4u  4 роки тому +1

      You can use any hash fn but the goal should be to minimize the collisions when two strings are different.

  • @sakshamsingh4071
    @sakshamsingh4071 4 роки тому +1

    simply awesome!!

  • @shibah9345
    @shibah9345 2 роки тому

    What problems could we encounter if we don't shift and simply add the value of the next character? A rigorous math approach would be nice.
    Thanks in advance.

  • @davidenachescu8616
    @davidenachescu8616 Місяць тому

    flawless

  • @NithivarnReddy
    @NithivarnReddy 4 роки тому +1

    The code provided is doing a different hash value calculation than that is being mentioned in the video. Can you please explain it?

    • @techdose4u
      @techdose4u  4 роки тому

      Please watch my video on Longest duplicate substring. I have implemented the hash there. This code was taken from geeks and so it can slightly differ.

  • @iamsanketray
    @iamsanketray 4 роки тому +2

    since we are taking exponential values, won't it lead to overflow for very large strings?

    • @techdose4u
      @techdose4u  4 роки тому +2

      We will use MOD for that. ex. 1e9+7

  • @YineMiBen
    @YineMiBen 3 роки тому +1

    Great explanation, 11:20 you forgot to put the mod P right?

  • @sainivasgandham7982
    @sainivasgandham7982 4 роки тому +1

    Thanks so much it helped me a lot

  • @joseph2073
    @joseph2073 3 роки тому

    thannku so so muchhhh

  • @tanvishinde805
    @tanvishinde805 3 роки тому +2

    Please could you explain with smaller prime number , so that I understand compute when mod p comes into picture, here the prime number is very big and so it is equivalent to not having mod p operation

    • @shubhisood4709
      @shubhisood4709 3 роки тому

      yes how calculated hash value came out to be 704 if we are using prime number 5381

  • @alexandersmirnov4274
    @alexandersmirnov4274 10 місяців тому

    when you calculating hash for the next window you are substracting first character and that can give you a negative result which will break all calculation

    • @PRabahy
      @PRabahy 7 місяців тому +1

      You need to perform a mod function after the subtraction to bring it back positive. In his example it wasn't required, but you are correct that sometimes it will be.

  • @badrulhussain5545
    @badrulhussain5545 3 роки тому +1

    Is this algorithm obsolete like the bubble sort.
    Since you have other efficient algorithms?

    • @techdose4u
      @techdose4u  3 роки тому +1

      It's useful atleast when you want to implement something. You can't implement harder and efficient codes easily. So this is useful for interview prep atleast.

    • @K_EC_AushoRoup
      @K_EC_AushoRoup 3 роки тому

      @@techdose4u This is something looking like, whatever I want I can implement for searching questions. Harder the hashing function, faster the algorithm.

  • @AmanBawane-o9q
    @AmanBawane-o9q 6 місяців тому

    Nice Video💘💘

  • @vaalarivan_p
    @vaalarivan_p Рік тому +1

    nibar prak : 1:00 - 1:51
    gnorts hsah : 6:40 - 9:25

  • @adarshgupta8162
    @adarshgupta8162 3 роки тому +1

    thnx a lot

  • @mercuriallabs9
    @mercuriallabs9 3 роки тому +1

    In stronger hash shouldn't you be subtracting 1x26^2%p?

  • @shubham-0152
    @shubham-0152 3 роки тому

    Pls jaldi ak ques karwa dijia hash with set mhujhe bahut dikkat aa rhi hai

  • @saurabhgupta1595
    @saurabhgupta1595 2 роки тому +1

    Thanks

  • @ibrahimshaikh3642
    @ibrahimshaikh3642 4 роки тому +1

    Got it

  • @ankushchhabra6092
    @ankushchhabra6092 4 роки тому +1

    nice explanation :)

  • @ArpitDhamija
    @ArpitDhamija 3 роки тому +2

    its 13 min. long but it takes 1 hr to note it down in notebook along the video

  • @gokulkumarbhoomibalan5413
    @gokulkumarbhoomibalan5413 4 роки тому +1

    Hey, why the complexity is O(n*m)? We have a stronger hash that matches only if the pattern and the window are the same no? We can make it O(n)?

    • @techdose4u
      @techdose4u  4 роки тому +1

      Yes. If you can guarañtee that hash will match only when required then it will be O(N). But you need to have a proof for this assumption.

    • @sharinganuser1539
      @sharinganuser1539 4 роки тому +1

      lets say for hash we took 1mb data as argument and return something of word size say 32bit /64bit integers .
      HASH(1mb)---->word(32bits) //our hash function.
      for simplicity lets talk just for ASCII(256) so our possible hashes can be 256^1million and for 32 bits i can only have 2^32 values .
      256^1million ------------to match------------> 2^32
      therefore for hash functions UNIVERSE size is always bigger then output size we are bound to have collisions .
      but collision frequency is 1/p {where p is some prime number}
      so u might want to have some very big number as p......but that will increase your operations time . so its a trade off .

    • @prodigysonhiddenforareason1239
      @prodigysonhiddenforareason1239 4 роки тому

      @@sharinganuser1539 Thanks Uchiha.

  • @aadityaupadhyay6264
    @aadityaupadhyay6264 4 роки тому +2

    How can we match two string ij 0(1) time ? I read it in editorial please explain sir
    I'm doing this in a question and i got TLE and in the editorial is written that we can compare the string in 0(1)
    Can you explain the procedure .
    Thanks in advance

    • @techdose4u
      @techdose4u  4 роки тому +1

      If you have preprocessed and stored as integer then you can compare in O(1)

    • @sharinganuser1539
      @sharinganuser1539 4 роки тому

      one can compute hash in O(1) time and that's the beauty of rolling hashes . But in order to see string u need to traverse at least ones so O(n) is best any string matching algorithm can perform .

  • @shubham-0152
    @shubham-0152 3 роки тому

    Bhai ak ques asa karwa dijia jisma hash ka sath (set) bhi use ho rha ho

  • @LP-ih2ye
    @LP-ih2ye 4 роки тому +1

    Sir why p[i] - 'A' at 2.11(at time )? why subtraction is happening?and Why 'A'?

    • @techdose4u
      @techdose4u  4 роки тому

      Subtraction to get relative ASCII value

    • @LP-ih2ye
      @LP-ih2ye 4 роки тому +1

      @@techdose4u why not 'B'? Or any other Alphabet like 'B', 'C'?

    • @techdose4u
      @techdose4u  3 роки тому +2

      Because A is the first letter hence counting should start from A. Doing A-A will give 0 and B-A will give 1 and so on.

  • @dharanyuvi6951
    @dharanyuvi6951 2 роки тому

    I think taking power of an integer can cause trouble if we have a larger pattern to match

  • @anshulgoel1940
    @anshulgoel1940 Рік тому

    Can someone explain why this hashing work. Or where will it fail. How to come up with a hashing strategy under different scenarios. Much appreciated. Thanks.

    • @codemode2925
      @codemode2925 Рік тому

      hashing may not be perfect or collision less, cause,
      lets say we have a 100 length string then there would be 26^100 diff strings to be hashed [for 26 diff characters] so it is impossible to store 26^100 different hashvalues, thus collisions are always a possibility. here in hashing we focus on probability of failure, thus aiming at minimising the probability of any such collisions.

  • @TheSteak1984
    @TheSteak1984 4 роки тому

    Thank you!

  • @TankNSSpank
    @TankNSSpank 4 місяці тому

    cool

  • @omaranbazna9066
    @omaranbazna9066 2 роки тому

    Time complexity of the video closing is O(1)

  • @sunilgautam2810
    @sunilgautam2810 4 роки тому +1

    sir please make a video on Z Algo

  • @kingaakashgoswami7735
    @kingaakashgoswami7735 3 роки тому +1

    Sir please explain the code too for this solution because i understand the logic but not able to frame the code even seeing from gfg.

    • @techdose4u
      @techdose4u  3 роки тому

      I had explained the code in a video but don't remember now 😅 It was some leetcode problem

    • @anushkachandel
      @anushkachandel 3 роки тому +1

      @@techdose4u Longest Duplicate Substring | TRIE | Rolling Hash | Binary Search | Leetcode This one Sir😅

    • @techdose4u
      @techdose4u  3 роки тому +1

      Thanks anushka :)

  • @shyamprakashm6325
    @shyamprakashm6325 4 роки тому +1

    Bro what could we do if they are providing some of the special character also 😶😶....how do we provide the hash function values for special character and some of the capital alphabet tooo

    • @techdose4u
      @techdose4u  4 роки тому

      Modify the hash function as per your wish. The goal is to minimize same hash values for different patterns :)

    • @shyamprakashm6325
      @shyamprakashm6325 4 роки тому

      Mmm i have an idea....value=primenumber%asciivalue(pattern[i])%(primenumber%asciivalue(pattern[i+1])%.....%

  • @himanshukaushal3467
    @himanshukaushal3467 2 роки тому

    SIR, AT 7:11 WHY ARE YOU TAKING PRIME NO. ??

  • @ankushroy919
    @ankushroy919 3 роки тому

    can u explain clearly the concept of taking prime no. only not any other no.

  • @sadharanInsaan122
    @sadharanInsaan122 3 роки тому

    The worst case time complexity of this algo can be O(n*m) so how is it efficient?

    • @adityarajsingh8110
      @adityarajsingh8110 19 днів тому

      The average time complexity is O(n), which is more likely to occur based on how well you defined your hash function

  • @ragingpahadi
    @ragingpahadi 4 роки тому +1

    Hi
    // Calculate the hash value of pattern and first
    // window of text
    for (i = 0; i < M; i++)
    {
    p = (d * p + pat[i]) % q;
    t = (d * t + txt[i]) % q;
    }
    how this is transforming into the explanation in video where we use base^(m-1) * charAt(i)+ base^(m-2) *charAt(i) ...... + base^0*charAt(i)

    • @techdose4u
      @techdose4u  4 роки тому

      Watch today's video. You will get more clarity on this topic.

    • @sharinganuser1539
      @sharinganuser1539 4 роки тому

      this is intuitive think in base 10 for example ....how u add . i.e lets window be [12345] and we r at 1234 so how u'll add last char is 1234*10+5 i.e p*(base)+ char[i].....nd mod it to prevent overflow.

  • @Yash-uk8ib
    @Yash-uk8ib 4 роки тому +1

    can we use strstr?.... if(strstr(originalstring,pat)!=NULL) printf("Yes")....

    • @techdose4u
      @techdose4u  4 роки тому

      You can use find as well as strstr. But when this question comes then surely you won't be allowed libraries.

    • @Yash-uk8ib
      @Yash-uk8ib 4 роки тому +1

      @@techdose4u ohkk.... thanku sir

    • @techdose4u
      @techdose4u  4 роки тому

      Welcome :)

    • @ankuradhey
      @ankuradhey 4 роки тому +1

      Strstr internally traverses and it doesn't make sense to use it during interviews.

    • @Yash-uk8ib
      @Yash-uk8ib 4 роки тому

      @@ankuradhey thank u sir

  • @bismeetsingh352
    @bismeetsingh352 4 роки тому

    Can you explain this from your code? What is this h ?
    for (i = 0; i < M - 1; i++)
    h = (h * d) % q;

    • @mailtobasit74
      @mailtobasit74 3 роки тому

      check this, you will get the answer medium.com/swlh/rabin-karp-algorithm-using-polynomial-hashing-and-modular-arithmetic-437627b37db6

  • @ayanraha880
    @ayanraha880 4 роки тому

    what is the name of the software you are using?

  • @pratikbhagwat95
    @pratikbhagwat95 3 роки тому

    I’m sure this guy rolled a hash before inventing this algorithm 😝

  • @heartstronggarden5134
    @heartstronggarden5134 8 місяців тому

    💕✌🏼😶‍🌫️ This is not the hash I was hoping to learn how to roll...

  • @vijaykumarlokhande1607
    @vijaykumarlokhande1607 3 роки тому

    before this i was thinking I know maps, no need to learn hashing. I was wrong.

  • @akashsahu6017
    @akashsahu6017 2 роки тому

    Code doesn't work!!!

  • @Kuil..
    @Kuil.. 2 місяці тому

    Those who watch on 2024 assemble here guys 🫂🎉

  • @anshurana7714
    @anshurana7714 2 роки тому

    Sorry sorry my mistake it's not that rolling 😀