Комментарии:
Very much helpful rather than other videos
ОтветитьYou are doing a great job. Learning alot from your videos.
ОтветитьWhich software/hardware do you use to whiteboard ?
ОтветитьSir , please make video on Boyer Moore algo , there is no good video about it on the net
Ответитьu should take different examples .. everything else was great
Ответить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
ОтветитьMind-Blowing Man, You are just Awesome!
Ответить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.
if string abmnbc then Longest PS is 1 but in yout logic its 0
ОтветитьCan u please give the playlist name in the description too?
ОтветитьGreatest of all time
Ответитьvector<int> lps(string s)
{
int n=s.size();
vector<int> ans(n,0);
ans[0]=0;
i=0;
int j=0;
for(j=1;j<n;j++)
{
if(s[i]==s[j])
{
i++;
}
else
{
while(i>0&&s[i]!=s[j])
{
i=ans[i-1];
}
}
ans[j]=i;
}
return ans;
}
bhaiya ye sahi hai khya please reply
great explanation thanks a lot
ОтветитьWhy everyone waste 5-10 mins in brute force 🤔🤔
ОтветитьCan you please provide java code for this algo
ОтветитьCan you tell me how creating the LPS array is O(n) and no quadratic?
Ответить@Tech Dose Can you make a video on Boyer Moore Searching algorithm also? It's there in Love Babbar sheet
ОтветитьVery clear explanation...thanks sir...
ОтветитьThanks for the video. can you pls explain how would traversal work in case text='aaaaab' and pattern ='aaab'?
Ответитьyou are just awesome.
Ответить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();
vector<int>lps(n,0);
int i=0;
int j=1;
while(j<n){
while(i>0 && 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<<a<<endl;
while(i<haystack.size()){
while(j>0 &&j<n && needle[j]!= haystack[i]){
j = lps[j-1];
}
if(j<n &&needle[j] == haystack[i]){
j++;
}
i++;
if(j==n)return i-n;
}
return -1;
}
};
I watched 3 videos previously... but this time I got the idea....... thankYou sir...
Ответитьlove the development of intuition ....that is the key
ОтветитьVery easy explanation, Thank u♥
Ответитьthank you
ОтветитьThe explanation is best in short time
ОтветитьBest explanation, I have already watched 3 videos but none of it could give me as much clarification as this video did .
ОтветитьBest explanation!!!! Thanks a lot!
Ответитьstill the best explaination found till now....!
Ответитьtu AA ja MERE close le le thoda TECCHDOSE
ОтветитьTHE C++ CODE OF THIS PROBLEM IS HERE
.....
.
.
..
.
..
.
.
..
...
.
.
....
.
.
.
.
..
.
..
..
...
KHUD SE KAR LE SAALE...SAB KUCH TO BATA DIYA
Best One!
ОтветитьGreat Explanation !!
Ответить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 <3
Ответитьmost underrated channel
Ответитьalso explain with code please !
Ответитьgood explaination, Thank you
Ответить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
Ответитьsuper bro
ОтветитьI feel lot of detailing is missed in this explaination. If some one wants a good understanding of kmp algo and how it works, please refere CodeNCode channel. Expected a better and thorough explaination sir.
ОтветитьWhy we are not moving i back to previous + 1 position?
ОтветитьBest video for KMP!!
Ответитьhands down.
best video on KMP
Great explanation, but I wanna ask whether u were the one in apna college for kmp algorithm. That video has the worst explanation.
ОтветитьKING!
ОтветитьTrying to get this algo once more in a coding career of 5 years. will comment again whenever i will try again
Ответить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 ❤
thanks :)
Ответить