Karp-Rabin String Matching Algorithm | Substring Search Pattern

Поделиться
HTML-код
  • Опубликовано: 30 сен 2024
  • Discover the inner workings of search engines like Google! In this video, we'll explore the Karp-Rabin algorithm, a powerful technique for efficient string searching using hashing.
    Take part in the learning in public initiative! Share your learnings on LinkedIn and Twitter with #DSAwithKunal & don't forget to tag us!
    👉 Resources
    - Join Replit: join.replit.com...
    - Lecture code: replit.com/@Ku...
    - Complete Java DSA playlist: • Java + DSA + Interview...
    - Code, Assignments, & Notes: github.com/kun...
    ➡️ Connect with me: kunalkushwaha.com
    👨‍💻 Join WeMakeDevs: wemakedevs.org
    #dsa #placement

Комментарии • 49

  • @KunalKushwaha
    @KunalKushwaha  2 месяца назад +2

    DSA + interview preparation playlist: ruclips.net/p/PL9gnSGHSqcnr_DxHsP7AW9ftq0AtAyYqJ

  • @poorpanda9033
    @poorpanda9033 11 месяцев назад +39

    If anyone is new to this bootcamp! Let me tell you it's amazing I've completed almost every single videos so far. By the end of the playlist you'll have so much confidence to tackle DSA questions by your own.
    Just make sure you're following the notes + assignments & Tips that kunal gives !!
    Some tips that I always remember when i approach a problem (kunal has mentioned it)
    - Don't memorize, understand the problem / logic
    - Hard Question is easy for those who have studied, Easy Question is hard for those who haven't
    - The function will return from where it was called !! ( Recursion )

    • @_Dream_Dive_
      @_Dream_Dive_ 3 месяца назад +3

      That last thing is the most important

  • @vaibhavimishra763
    @vaibhavimishra763 11 месяцев назад +1

    Best course i suggested many friends ❤❤❤❤

  • @sagarsunar6501
    @sagarsunar6501 Месяц назад

    Thanks, sir!!

  • @theseriousguy2136
    @theseriousguy2136 8 месяцев назад +3

    I guess the CalculateHash function will get to the limit of mathematical computations. suppose str.length() is around 1000
    It would need to calcu;ate 101^1000 and that is out of bounds of long storage, and I guess pow() too couldn't cacluate it.

  • @KunalKushwaha
    @KunalKushwaha  11 месяцев назад +2

    👉 Resources
    - Join Replit: join.replit.com/kunal-kushwaha
    - Lecture code: replit.com/@KunalsReplit/KarpRabin-Hashmaps

  • @adolfocarrillo248
    @adolfocarrillo248 8 месяцев назад +3

    Kunal that updateHash method is kind of clever ha!! nice technique!!! Thanks for sharing your knowledge!!!!

  • @believe_it2380
    @believe_it2380 11 месяцев назад +2

    These videos are so great, i am also done with each and every video, and just looking forward for notification of new Videos, .... It would be very grateful of Mr. Kunal if he could be more frequent in uploading videos, ❤❤ i don't have much patience for your videos

  • @lakshitjain6923
    @lakshitjain6923 11 месяцев назад +4

    Sigma uploaded 2 videos at 3 am

  • @elco7956
    @elco7956 11 месяцев назад +2

    I don't really understand the updateHash function

  • @shadowmonarch1432
    @shadowmonarch1432 11 месяцев назад +2

    At 2:20 the example ur explaining is sliding window technique with a TC of O(26*N)(for this problem) = O(N)
    By the way Big Fan bruh❤️

    • @shyam4034
      @shyam4034 11 месяцев назад

      Ninnu ekkado chusa bhayya

    • @bahultyagi
      @bahultyagi 10 месяцев назад +1

      Yes he said its O(n*n) which is wrong

  • @tusharkumar2290
    @tusharkumar2290 11 месяцев назад +7

    String has a function called contains( " "). It has Log n complexity :) , Rabin karp can be said as more algorithmic approach whereas contains can be classified as general apporach

    • @New_Movie_Watch
      @New_Movie_Watch Месяц назад

      Ya your right ✅ I'm also thinking we can use contain function to why so use this

    • @01_cseaiml_aaravraj96
      @01_cseaiml_aaravraj96 25 дней назад

      Yes but it will give Boolean answer but we need the index

  • @simalinaaz5640
    @simalinaaz5640 11 месяцев назад +3

    Second video on same day❤

  • @sheikhmkrifat7749
    @sheikhmkrifat7749 11 месяцев назад

    Love from Jashore University of science and technology ,Bangladesh Sir❤. I am from non cs, following you to be a selftaught programmer.

  • @atharvameher5880
    @atharvameher5880 9 месяцев назад

    Would this work using something non-prime?

  • @ALIHAMZAAKRAM-oe2su
    @ALIHAMZAAKRAM-oe2su 11 месяцев назад +1

    I like to say Rabin-karp is it okay

  • @rishu_singh_
    @rishu_singh_ 9 месяцев назад

    what if we need to count that how many times b string contains a

    • @sufiserious798
      @sufiserious798 4 месяца назад

      Just use a counter variable, and in the condition where all characters match, increase counter by 1.
      At the end when the loop ends either return or print the value of counter.

  • @Bavasharan
    @Bavasharan 9 месяцев назад

    Can anyone pls explain why we divide by prime in order to get new hash

    • @aveshsingh491
      @aveshsingh491 8 месяцев назад +1

      since we were multiplying with prime in order to calculate the hash with that character and now since we want to remove that character from our window therefore we need to not just subtract that character but as well divide the new hash with the prime.

    • @Bavasharan
      @Bavasharan 8 месяцев назад

      @@aveshsingh491
      tq so much

  • @ShivamKendre-fc3su
    @ShivamKendre-fc3su 3 месяца назад

    Great video

  • @piyushgupta8763
    @piyushgupta8763 11 месяцев назад

    Cant we just use b.contains(a)?

    • @shyam4034
      @shyam4034 11 месяцев назад

      That also uses an algorithm similar to this one .

  • @NavneetKumar-lg3nv
    @NavneetKumar-lg3nv 4 месяца назад

    not able to understand line no 13

  • @easterntoronto
    @easterntoronto 11 месяцев назад

    GOAT for a Reason....👍

  • @jk-sm6qr
    @jk-sm6qr 6 месяцев назад

    Thanks Kunal!!

  • @apjdumer9233
    @apjdumer9233 11 месяцев назад

    Inspirational ❤❤❤

  • @ArpitKhandelwal-w7r
    @ArpitKhandelwal-w7r 6 месяцев назад

  • @ayushprasad8207
    @ayushprasad8207 11 месяцев назад

    Wah ek sath

  • @RishiRajxtrim
    @RishiRajxtrim 11 месяцев назад

    🙏👍

  • @LowkeyCoder
    @LowkeyCoder 11 месяцев назад

    ❤❤❤

  • @sathishloal_vlogs
    @sathishloal_vlogs 8 месяцев назад

    Bro actually it takes n-pattern length times iterated and in each iteration it takes two iterations of length of pattern for generating hashcodes and also checking for same characters or not, if hash is matched
    Finally it also take O(nxm ) time ❤
    Tell me if im wrong☺️
    But krunal playlist is awesome🧡🧡🧡

  • @Liku108
    @Liku108 11 месяцев назад +1

    Hey kunal can you give a refferal to me

    • @KunalKushwaha
      @KunalKushwaha  11 месяцев назад +5

      no

    • @Liku108
      @Liku108 11 месяцев назад +1

      @@KunalKushwaha ok but please make a video for how to apply for Google

    • @KaizokuOuNaruto
      @KaizokuOuNaruto 11 месяцев назад +1

      ​@@KunalKushwaha40lpa fraud will refer? LOL
      made fools out of lakhs of people and that devops course has gone extinct
      just uploads promotion videos of tools these days.. free free ke chakkar me big scam of trust... fraudster kunal

    • @KaizokuOuNaruto
      @KaizokuOuNaruto 11 месяцев назад +4

      ​@@KunalKushwahaYou wont reply to or atleast complete your bootcamp
      but youll show arrogance for someone asking you a referral politely.. karma hits back fraudster... played games with trust,viral controversies,hype.. and the end result is zero..

    • @gojosatoru988
      @gojosatoru988 11 месяцев назад +13

      ​@@KaizokuOuNarutowhat karma bro, if you don't like him don't watch his videos.
      Previously these types of detailed courses were paid, a kind man started it for free while managing his own work, and you're calling him fraud!!!!!
      Cheap mentality 😞