KMP algorithm | Pattern search algorithm | string search algorithm

  Рет қаралды 93,703

Techdose

Techdose

Күн бұрын

Пікірлер: 99
@mayank_upadhyay_19
@mayank_upadhyay_19 4 жыл бұрын
Actually, I was not expecting to understand much from video, but surprisingly it made the concept more clear than any other.
@JaiPrakash-ku7it
@JaiPrakash-ku7it 3 жыл бұрын
This was the third time, trying to understand the KMP in last one year. And finally got it. Thanks man! Great work.
@techdose4u
@techdose4u 3 жыл бұрын
Welcome :)
@NAVEENKUMAR-uj7xe
@NAVEENKUMAR-uj7xe Жыл бұрын
Same case @jai i dont know why It was so confusing ...🤔
@fraisespasmures9683
@fraisespasmures9683 Жыл бұрын
Thankksss a lot for this video. I've watched 3 videos trying to understand this algo you're the first one to achieve it with very clear explanations and revelent example. Thanks man
@om23999
@om23999 Жыл бұрын
Best explanation, I have already watched 3 videos but none of it could give me as much clarification as this video did .
@techdose4u
@techdose4u Жыл бұрын
Great :)
@adityasikarwar7090
@adityasikarwar7090 Ай бұрын
I am trying understand the from last 4 hours , I read article at gfg but don't get get whole clarity and also watch many videos on ytube but don't understand complete working, But after watching this video I am completely confident about working of algorithm. Thanks sir ❤
@techdose4u
@techdose4u Ай бұрын
welcome :)
@anirbanpal9432
@anirbanpal9432 3 жыл бұрын
Best explanation, I'll be honest before watching it I have already watched 3 videos and 2 articles, but none of it could give me as much clarification as this video did. Thanks @Tech Dose
@techdose4u
@techdose4u 3 жыл бұрын
Welcome :)
@inFamous16
@inFamous16 2 жыл бұрын
Also refer Abdul Bari Sir's channel
@debanjanchakraborty9946
@debanjanchakraborty9946 Жыл бұрын
The explanation is best in short time
@techdose4u
@techdose4u Жыл бұрын
Thanks :)
@sureshdoodler
@sureshdoodler Жыл бұрын
most underrated channel
@agnivashil4130
@agnivashil4130 Жыл бұрын
still the best explaination found till now....!
@techdose4u
@techdose4u Жыл бұрын
Thanks :)
@shivangitiwari2485
@shivangitiwari2485 3 ай бұрын
hands down. best video on KMP
@diveshrajput572
@diveshrajput572 3 жыл бұрын
Very much helpful rather than other videos
@techdose4u
@techdose4u 3 жыл бұрын
Thanks :)
@jyotikumari-lp1qh
@jyotikumari-lp1qh 4 жыл бұрын
best video of KMP thank you sir👏
@techdose4u
@techdose4u 4 жыл бұрын
Welcome :)
@anurag6219
@anurag6219 2 ай бұрын
Trying to get this algo once more in a coding career of 5 years. will comment again whenever i will try again
@techdose4u
@techdose4u 2 ай бұрын
woww. cool
@Dee_Rai
@Dee_Rai 3 жыл бұрын
You are doing a great job. Learning alot from your videos.
@techdose4u
@techdose4u 3 жыл бұрын
Thanks :)
@devraj-2310
@devraj-2310 2 жыл бұрын
I watched 3 videos previously... but this time I got the idea....... thankYou sir...
@katilak1827
@katilak1827 3 жыл бұрын
Mind-Blowing Man, You are just Awesome!
@techdose4u
@techdose4u 3 жыл бұрын
Thanks :)
@lambar0
@lambar0 Жыл бұрын
love the development of intuition ....that is the key
@nanditmaheshwari1363
@nanditmaheshwari1363 4 ай бұрын
Best video for KMP!!
@sarthakkumar856
@sarthakkumar856 2 жыл бұрын
As always you have got the best explanation on youtube. Thank you so much for making this subject easy❤
@renon3359
@renon3359 3 жыл бұрын
You definitely deserve much more likes and subscribers brother. Great content.
@techdose4u
@techdose4u 3 жыл бұрын
Thanks
@shourabhpayal1198
@shourabhpayal1198 3 жыл бұрын
Greatest of all time
@techdose4u
@techdose4u 3 жыл бұрын
🤗
@kanchidoshi6907
@kanchidoshi6907 2 жыл бұрын
Thanks for the video. can you pls explain how would traversal work in case text='aaaaab' and pattern ='aaab'?
@RupamSasmalYt
@RupamSasmalYt Жыл бұрын
Very easy explanation, Thank u♥
@techdose4u
@techdose4u Жыл бұрын
Welcome :)
@rishabhkumar8115
@rishabhkumar8115 3 жыл бұрын
thanks for this video...you deserve this...man
@sunwoodad
@sunwoodad 4 жыл бұрын
From the above example, text: "abx abc abc aby", pattern: "abc aby" You said, when 'y' of pattern doesn't match with 'c' at text, we need to move the pattern pointer back until finding 'c', so we can stop at "abc" at pattern and move forward. I think it's wrong. I mean it's okay at above example. But, what if the text is "abx abc dec def", pattern: "abc def" ? When pattern sees 'f' doesn't match to 'c', the pointer of pattern will move back until finding 'c', but "dec" of text and "abc" at pattern doesn't match. And it will eventually determine it found the pattern from the text, but it didn't.
@harsha-kiran
@harsha-kiran 4 жыл бұрын
Either use finite state automata or while matching current charcter when moving backwwrd on pattern, check whether the pattern from the start matches too
@ankuradhey
@ankuradhey 4 жыл бұрын
In pattern "abc def" there is no longest suffix which has matching prefix, so pattern search would start from first index of pattern string and it would result into a non match. Watch complete video in which there is a LPS array is created.
@Bakasta170
@Bakasta170 3 жыл бұрын
I am also not getting this even after watching full video
@John83118
@John83118 9 ай бұрын
Such an outstanding job! I recently enjoyed a similar book, and it was an absolute masterpiece. "Game Theory and the Pursuit of Algorithmic Fairness" by Jack Frostwell
@WrongDescription
@WrongDescription Жыл бұрын
Best explanation!!!! Thanks a lot!
@girikgarg8
@girikgarg8 3 жыл бұрын
@Tech Dose Can you make a video on Boyer Moore Searching algorithm also? It's there in Love Babbar sheet
@shreyjain51
@shreyjain51 5 жыл бұрын
This channel will become big one day!!!
@techdose4u
@techdose4u 5 жыл бұрын
Thanks shrey :)
@kr_ankit123
@kr_ankit123 2 жыл бұрын
Code for the above explanation in C++. Here haystack is text and needle is pattern to be matched. Kindly refer it. class Solution { public: int strStr(string haystack, string needle) { int n = needle.length(); vectorlps(n,0); int i=0; int j=1; while(j0 && needle[j]!=needle[i]) i = lps[i-1]; if(needle[i] == needle[j]) i++; lps[j]= i; j++; } i=0; j=0; // for(auto a:lps)cout
@yashgajewar9019
@yashgajewar9019 Жыл бұрын
Great Explanation !!
@abhinavkumar6344
@abhinavkumar6344 9 ай бұрын
good explaination, Thank you
@mainakmondal5228
@mainakmondal5228 2 жыл бұрын
Very clear explanation...thanks sir...
@anonymoussloth6687
@anonymoussloth6687 3 жыл бұрын
I don't understand one thing. suppose we have a pattern like this: txt: a a a b a (and so on...) pat: a a a b b lps: 0 1 2 0 0 In this case, where there is a mismatch at the last a and b, I understand why pat is started at 0. because there is no prefix that is also a suffix at that point in the pattern. But why is the txt pointer not shifted back?? How can we be sure that if the pattern is just shifted one place to the right (like in the naive/brute force method) that we won't find a match? meaning: a a a b a ... a a a b b I know in this case it is not a match, but how can we be sure that this is the case always? My question basically is, in this algo, we have a i pointer that is iterating through the txt and a j pointer that is iterating through the pat. when there is a mismatch, the j pattern is shifted back a certain amount (which i understand why) but the i pointer is not shifted at all. THIS is what I don't understand. j pointer is shifted based on if there is a prefix that is also a suffix and that makes sense. But i dont understand why the i pointer is not shifted REGARDLESS of whether a prefix is found or not.
@khatrinitish
@khatrinitish 6 ай бұрын
I have same query
@mahipalsingh-yo4jt
@mahipalsingh-yo4jt 3 жыл бұрын
Great explanation..!!!!!!!!!
@techdose4u
@techdose4u 3 жыл бұрын
Thanks :)
@sharanpreetchadha3579
@sharanpreetchadha3579 3 жыл бұрын
Sir , please make video on Boyer Moore algo , there is no good video about it on the net
@techdose4u
@techdose4u 3 жыл бұрын
Noted :)
@EinstienJr
@EinstienJr 2 ай бұрын
KING!
@neilteng4161
@neilteng4161 4 жыл бұрын
Why dont we need to take care of the mode when we subtract the first character and add the last one?
@ghumakkad_yogi
@ghumakkad_yogi 4 жыл бұрын
Please make video on kmp search also
@techdose4u
@techdose4u 4 жыл бұрын
This is KMP search itself. I have just written sublist search. Both are same.
@ghumakkad_yogi
@ghumakkad_yogi 4 жыл бұрын
@@techdose4u okkk
@nidhiprakash5084
@nidhiprakash5084 3 жыл бұрын
Can u please give the playlist name in the description too?
@techdose4u
@techdose4u 3 жыл бұрын
Sure I will
@ALEEMKHAWAR1
@ALEEMKHAWAR1 2 жыл бұрын
you are just awesome.
@poorbidalal
@poorbidalal Жыл бұрын
Best One!
@sharuk3545
@sharuk3545 3 жыл бұрын
if string abmnbc then Longest PS is 1 but in yout logic its 0
@ayushshukla2655
@ayushshukla2655 11 ай бұрын
also explain with code please !
@JayantiChowdhury-x8u
@JayantiChowdhury-x8u 4 ай бұрын
Why we are not moving i back to previous + 1 position?
@RomanEmpire29
@RomanEmpire29 3 жыл бұрын
great explanation thanks a lot
@rankushvishwakarma5658
@rankushvishwakarma5658 4 жыл бұрын
Good job sir!
@techdose4u
@techdose4u 4 жыл бұрын
Thanks :)
@statusdeveloperss1234
@statusdeveloperss1234 5 ай бұрын
super bro
@vaalarivan_p
@vaalarivan_p Жыл бұрын
3:16 - 5:25
@AniketSomwanshi-ll7mz
@AniketSomwanshi-ll7mz 3 жыл бұрын
Can you tell me how creating the LPS array is O(n) and no quadratic?
@rithikraj1813
@rithikraj1813 3 жыл бұрын
Why everyone waste 5-10 mins in brute force 🤔🤔
@techdose4u
@techdose4u 3 жыл бұрын
I shouldn't 😅
@prakhargupta3949
@prakhargupta3949 Жыл бұрын
thank you
@akshatchouhan5199
@akshatchouhan5199 3 жыл бұрын
Can you please provide java code for this algo
@devmahad
@devmahad 20 күн бұрын
thanks :)
@techdose4u
@techdose4u 20 күн бұрын
welcome :)
@protyaybanerjee5051
@protyaybanerjee5051 3 жыл бұрын
Which software/hardware do you use to whiteboard ?
@bharatkumar-be9ki
@bharatkumar-be9ki 4 жыл бұрын
This video is really confusing because you are overwriting everything. Nothing seems making sense. First you should tell the logic and then the algorithm.
@prakashpratapsingh7323
@prakashpratapsingh7323 2 ай бұрын
Great explanation, but I wanna ask whether u were the one in apna college for kmp algorithm. That video has the worst explanation.
@techdose4u
@techdose4u 2 ай бұрын
Thanks. I am only on Techdose and no other platform.
@satishshingade8514
@satishshingade8514 3 жыл бұрын
u should take different examples .. everything else was great
@akshatjain6854
@akshatjain6854 4 жыл бұрын
This is really confusing!
@Bakasta170
@Bakasta170 3 жыл бұрын
shi me yaar ;(
@tanishasethi7363
@tanishasethi7363 3 жыл бұрын
Ikr
@Masarap1959
@Masarap1959 5 жыл бұрын
Can you tell its background?
@techdose4u
@techdose4u 5 жыл бұрын
What background??
@Masarap1959
@Masarap1959 5 жыл бұрын
Drawback and application of Sublist?
@spetsnaz_2
@spetsnaz_2 4 жыл бұрын
@@Masarap1959 I think it uses an LPS array, so extra space is used...This is the drawback I see
9.1 Knuth-Morris-Pratt KMP String Matching Algorithm
18:56
Abdul Bari
Рет қаралды 1,7 МЛН
Knuth-Morris-Pratt KMP String Matching Algorithm | Search Pattern | GFG POTD
1:05:36
Thank you Santa
00:13
Nadir Show
Рет қаралды 21 МЛН
Rolling hash | Rabin karp algorithm | Pattern searching
13:09
Techdose
Рет қаралды 107 М.
Exponential Search - better than Binary search? (Explained)
11:23
9.2 Rabin-Karp String Matching Algorithm
23:50
Abdul Bari
Рет қаралды 820 М.
8 patterns to solve 80% Leetcode problems
7:30
Sahil & Sarra
Рет қаралды 438 М.
Knuth-Morris-Pratt(KMP) Pattern Matching(Substring search)
12:50
Tushar Roy - Coding Made Simple
Рет қаралды 1,1 МЛН