even the paid course don't teach you with this much perfection hats off to tushar for this and many other videos like this .
@siddheshshinde48502 жыл бұрын
This video is absolutely perfect. Everything is explained very well from the fundamentals to the implementation part.
@shahinshahsavari12754 жыл бұрын
I spent so much time trying to understand this from someone else's the source code. Watching this cleared up all my confusions. Thanks!
@Nikhil-ov6sm Жыл бұрын
ok this is one of the few times where writing code is way more tougher than getting the logic..thanks btw great video
@satviktejas6085 Жыл бұрын
One of the best explanation available on internet
@sanketneema2866 ай бұрын
Tushar is a saver, it looks like other KZbinrs also watch Tushar's videos to clear their doubts.
@Aditya-wj5gy Жыл бұрын
Thanks for such a wonderful explanation. This algo is one of the hardest as there are many variables you need to track and requires practice.
@yogeshyogesh87898 жыл бұрын
Brother, I have started exploring String Algorithms few days back and , believe me , this is best resource I have found so far on the whole internet.
@abhisheksharma70563 жыл бұрын
we can use even lps(longest prefix suffix) array of appended string to find out the index of matching
@aashutoshagrawal52392 ай бұрын
Loved the explanation.. Thank you for the video.
@shubhamk8404 жыл бұрын
best video tutorial amazing Mr. Tushar.
@AGENTxxFURY Жыл бұрын
Best explanation , awesome teacher !!!
@saurabhsharma71237 жыл бұрын
String Theory has always been a mystery for me until just now!Cannot thank you more !
@shreyjain514 жыл бұрын
This is not called "String Theory"!!! That is a branch of physics.
@genuineprofile64002 жыл бұрын
It's still is a mystery to you and other physicists.
@shuangli5466 Жыл бұрын
excellent explaination, I understood it instantly
@sanjeevacham24009 жыл бұрын
Excellent Tushar , you done it again.
@omprakashsharma97674 жыл бұрын
I always like your videos, to the point no time wasting.
@vijay_lakra9 жыл бұрын
Very good explanation.Thanks Tushar.
@malharjajoo73937 жыл бұрын
+Tushar Roy -great explanation as usual , clearly shows how well you understand.
@keilamartinez73944 жыл бұрын
Absolutely great! You made it very easy to understand the algorithm, thank you so much!!
@tahanimachowdhury9 жыл бұрын
Thanks a ton :D Waiting for Aho - Corasick and Finite State Automation :D
@Shawn90818 жыл бұрын
8 months later im still alive but no video ;'{
@adhishmalviya24084 жыл бұрын
4 years later, NO video
@muthojusaketh3 жыл бұрын
4yrs 10 months later, no video :(
@jotsinghbindra83175 ай бұрын
8years now still no video
@smartwork70982 ай бұрын
Beautiful man. Edit: Beautiful explanation, man
@sgerodes6 жыл бұрын
Awesome explanation. Thank you very much
@marcolunardi36304 ай бұрын
Excelent video, helped a lot
@MrDirtzuke4 ай бұрын
true
@shekhar30278 жыл бұрын
wow..!! Thanks alot Tushar..!! Your tutorials are always informative and are in detail. But the best part is that its easily explained and extremely easy to understand and implement... :)...
@udaysabbisetty95092 жыл бұрын
Man!!!That's Amazing Explaination...Thank You:)
@shivampratapsingh21887 ай бұрын
Amazing explaination !!11
@aniketsriwastva63454 жыл бұрын
Great Explaination Sir
@saqibmasood5015 ай бұрын
Nicely explained
@gandhijainamgunvantkumar67832 жыл бұрын
Amazing explanation 😀
@ankitm5116 жыл бұрын
Nice explanation :) Very easy to understand compared to reading about it
@prashantkaushal4057 Жыл бұрын
at 21:04 time it will go the if condition because k is not greater than right but it is equal to right
@savanmatariya74943 жыл бұрын
Well Explained!!, Keep it up
@quyenamba45568 жыл бұрын
It's very helpful and easy to understand :D Thanks u so much
@pramodprajapati91666 жыл бұрын
Great Job as Always. I did understood the Algorithm instantly, but struggled in the implementation. Can you give any tips to improve on the implementation part. Maybe something I need to do or something I might be doing wrong.
@fruith_2 жыл бұрын
Thankiu. Hope to wacth multiple matrix
@ankitkumar-et8ew5 жыл бұрын
What happens if parent string is 'aaaaa' and we have to calculate the no. Of comparison then it should be 4+3+2+1 or we can say it is of the form n+n-1+n-2+....1 therefore it's complexity is On^2
@KanagaveluSugumar8 жыл бұрын
Wow! you have done a great job :) And is that reusing match count within the Z box is benefit will i get compare to brute force ?? if not how it is better than brute force ?
@cm30tanaykulkarni143 жыл бұрын
INFORMATIVE
@ningwang80778 жыл бұрын
you help me a lot, hope you upload more videos and I will always follow your channel~
@glaucoa.92143 жыл бұрын
Thanks alot Tushar..!!
@saurabhv18 жыл бұрын
What if the main string can consist of any utf8 character ? How to choose a special character in such a case ?
@Nate-kw9by9 ай бұрын
Great tutorial!
@ketan_sahu3 жыл бұрын
Great explanation. Thanks!
@srijonmuhtasim36693 жыл бұрын
helped a lot to understand the concept
@DeepakKumar-wu4dt4 жыл бұрын
Really Helpful . Thanks
@harshitgangwar14264 жыл бұрын
Good Job Brother.
@malharjajoo73937 жыл бұрын
+Tushar Roy - your explanation is great , but it would be really good if you can give some context about the algorithm , like how difficult it is , etc.
@venkatnarasimha13179 жыл бұрын
Excellent tutorial. I have one question to ask. Why should we prepend the pattern to the string. Instead we can also compare while it is a different string
@sarthakbansal13034 жыл бұрын
Great explanation !!!
@mohit77172 жыл бұрын
For user input how i will know that special character are not exist in the input given by user ? How can we solve this problem
@KittyMaheshwari2 жыл бұрын
Excellent!
@ChinmayTerse8 жыл бұрын
Minor issue at 11:48 shouldn't it be greater than or equal to 1? Great video though!
@pawantiwary20438 жыл бұрын
what is the condition used at this timestamp? I did not understand. Could you please exlain?
@pranaykanjolia90774 жыл бұрын
Yaa, it should be greater than or equal to 1
@BenevolentKhalluudi8 жыл бұрын
Really great explanation. Thank you very much for the effort to explain it clearly!
@sheetal8318 жыл бұрын
Thanks alot bro!!! Such a great explanation of the algorithm :)
@ranganroy84943 жыл бұрын
on 11:16 when on index 13 the value of the Z array is 5, then 13+15 is crossing our Z box by 1 index. So, why we are not recalculating it again?
@ranganroy84943 жыл бұрын
It will be great if anyone could help me out with this.
@juzhengzhang30593 жыл бұрын
Should Z[0] = the length of original string?
@dronelektron9 жыл бұрын
As always great
@Vicky-pu5fw8 жыл бұрын
sir please upload video of TRIE/ Prefix tree
@sauravsingh72164 жыл бұрын
Awesome bro.....,
@nwanzefranklin77779 жыл бұрын
thanks a lot tushar, it really helped
@markjethropacheco45466 ай бұрын
I don`t understand the O(m+n) part. I don`t understand its purpose.
@ScramblerUSA8 жыл бұрын
Honestly, it's not right. When you copy the values from Z-box to Z-box, you make a comparison for every number to find out whether it falls beyond the right boundary or not. Why these comparisons are not accounted for?
@deepankarsingh72308 жыл бұрын
I am also wondering why its not counted in this video. Probably if we count that too, it should not go beyond linear time. But what will be the proof of that??
@sundeepb8 жыл бұрын
Yes, they should be counted, but that still makes the algorithm in linear time because when it falls in the right bounds, we will just copy the count, saving multiple comparisons from the first time. When it is out of bounds, we are going beyond the Z box, making new comparisons.
@pramodprajapati91666 жыл бұрын
I think you are confused here because of the while in the for loop. Watchout that the while comparison is known and withing the Bounds (i.e 0-Left and R to Length at most). So it will not be n^2 complexity. If the while comparison was from 0 to N then it will be n^2
@CryingMG9 жыл бұрын
Great tutorial as always. Good job!
@biboswanroy66994 жыл бұрын
I'm your fan now
@edelfrefloresmamani45624 жыл бұрын
nice explanation :)
@dineshkumar-kz3nc4 жыл бұрын
good explation of algorithm and code both. Generally doesn't find the code explanation easily so good job. I guess all u need to improve that use something much digital and clear then this white board that's all.
@kaal_bhairav_244 жыл бұрын
13:24 here we go digital
@bishyankar23888 жыл бұрын
Scanner sc=new Scanner(System.in); String s=sc.next(); String s1=sc.next(); int i; for(i=0;i
@bishyankar23888 жыл бұрын
i tried it codechef
@bishyankar23888 жыл бұрын
how are you calculating the time complexity
@bishyankar23888 жыл бұрын
mine
@elllot_7 жыл бұрын
You do realize this is a O(m*n) (O(m*(n-m) to be exact) comparison where m is the length of the pattern and n is the length of the string algorithm compared to Z algorithm's O(n) complexity right? You're doing a comparison for the full pattern at each index. I do not buy your statement that this performed better than the Z algorithm. I think you should double check your implementation of the Z algorithm
@ninhtrinh85363 жыл бұрын
Thank you very much !
@mujahidansorimajid15243 жыл бұрын
what if my pattern or my text the '$' exist will the code still work fine?
@imyashdeepsharma9 жыл бұрын
Awesome algorithm sir :)
@imyashdeepsharma9 жыл бұрын
+Tushar Roy Please post LCA Queries sir
@singhalvikash7 жыл бұрын
Hey Tushar , Great videos and explanation . Keep up the good work ! Do you have a video tutorial created for Sliding Window algorithm as well ?
@jithinbabu69024 жыл бұрын
Thank you for the great explanation. I have one doubt though. We can do this algorithm even without $ right?
@francineidesilva53104 жыл бұрын
vhx.n ,o
@madhankumar84632 жыл бұрын
No, there is a chance that the pattern maybe formed when we join the pattern and string.
@Inotaku3 жыл бұрын
why we need the line right--; ?
@anurag62192 жыл бұрын
AHHH NICE EXPLANATIONS !!!!!
@lonandon3 жыл бұрын
When to use Z Algorithm and when to use KMP?
@gigelfranaru7 жыл бұрын
But why not just use a for that goes along the main text and looks for the pattern chars in sequence, and when a mismatch occurs, reset the index of where to look into in the pattern string. Why do all this work ?
@danielmitre7 жыл бұрын
The index you are in the sequence have to reset to previous+1, so it is O(n²) time complexity
@martokalinov3733 Жыл бұрын
Thank you!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!:)
@pawantiwary20438 жыл бұрын
Thanks for this video but I did not understand at 11:48...Could you (or any one)please explain this condition?
@mishramadhur8 жыл бұрын
At this time stamp, we are at index 17 now since this character is in Z-box(notation used in video) we want to take its value from the previous position i.e from index 4, if we take its value 4 from the previous index(4), it means that a prefix of length 4 of the original string matches the suffix starting at index 17, but since the total length of string is only 18, the value can't be 4, since the suffix starting at index 17 can be of length 1 only. Hence the value is min(prev_value_taken, remaining length) i.e min(4, 18-17) = 1. Hope it helps
@sarwarjahan058 жыл бұрын
Can i make table like kmp for z (pattern+$+text)?
@gal1l1l-f7c9 жыл бұрын
Thanks Tushar, great video! :) Can you explain Aho-Corasick in another one?
@durgeshdeep25449 жыл бұрын
Thanks Tushar
@rohitraj43946 жыл бұрын
how you will compute Z Array for Pattern P = caca and String = cacacacacacacacacaca. Please explain.
@vedicdutta28566 ай бұрын
Awesome!
@subtlechords3 жыл бұрын
Thankyou so much
@fruith_2 жыл бұрын
Hope you reply, but if it's not, it's okay
@rahukdubey81383 жыл бұрын
while watching this video my brother (small haldi bilauwa) was beating me
@ritikbansal48514 жыл бұрын
Can anyone explain to me why do we do right - - in calculatez function. Thanks in advance
@shreyjain514 жыл бұрын
He made a mistake at 10:04. It is not 17, it is 16.
@SNM_237453 жыл бұрын
thank you
@edwardnjoroge52223 жыл бұрын
You rock! Thank you!
@somesome13153 жыл бұрын
helpful thx
@grev77948 жыл бұрын
thank you :) very helpful
@duydangdroid7 жыл бұрын
12:01 char[18] should be compared to char[5], not char[1]
@deepalikhalkar18806 жыл бұрын
Duy Dang correct
@satishkumarpatra48965 жыл бұрын
That's why he used l and r to specify where he can directly write or not. He did it correctly.
@timothyfield61908 жыл бұрын
Very Helpful! Thank you.
@yuvraj20382 жыл бұрын
Who is here after today's Leetcode contest?
@FelipeRodrigues-lj1el8 жыл бұрын
Thank you!
@omaryasser23088 жыл бұрын
Thank you very much. :)
@ep.jonnadula8 жыл бұрын
plz speak at normal speed at starting of video.every thing else is too good