Vivek -- I don't know what I would do without your explanations. You are the best algorithms teacher on UA-cam. You are the best I've ever seen. Keep doing what you're doing, it's helping a lot of people!
i know im asking randomly but does anyone know of a method to get back into an instagram account? I was stupid lost my login password. I would appreciate any tips you can give me.
Sir, Your videos on Dynamic programming are awesome. Please make following videos if possible, Sir : 1) Given a string, determine if a permutation of the string could form a palindrome. 2) Count All Palindrome Sub-Strings in a String 3) Find all distinct palindromic sub-strings of a given string 4) Longest common substring 5) Longest Palindromic Substring 6) Print all palindrome permutations of a string 7) Print all palindromic partitions of a string
Thanks Vivekanand for your nice video. In my opinion, you should provide some explanation to the audience about why - choosing the diagonal cell + 1 in the case of two characters are the same (for example LCS(x[m], y[n]) = LCS(x[m-1], y[n-1]) + 1 and (m-1, n-1) is the diagonal cell position); - choosing the max of the upper row, same column as LCS(x[m-1], y[n]) and same row, left column as LCS(x[m], y[n-1]) when two characters are different.
sir, the question is find the number of characters that can be removed in the given string to make it a palindrome. using dynamic programming We have to return the count sir. Eg : input1:mabm output1: 1(explanation: by removing b we get palindrome) input2: abbbcdae output2 : 3(explanation: by removing c,d,e we get palindrome)
In the first instance we were looking for common subsequence between ab and b, so if we already had the count of subsequence between a and null (which is diagonally top left of the current cell) and then included b (which is common to both and is the current cell), then the common subsequence would increase by 1 (0 + 1). So when we find a common character we look at what the count of the subsequence was before that character was included, we do this by looking at the value of the cell diagonally top left of the current cell
at the end of the video the algorithm is a little wrong because if i=0 and j=0 and str1[i]==str2[j] than you cant do T[i-1][j-1]. ty very much for the video though. really helped me
Sir, but the program you wrote only makes the matrix ready....but it doesn't tell about How to form the corresponding lcs STRING from matrix.. Thus this video is amazing but incomplete
I tried to write code to find the letter themselves and i came up with this: def find_index(arr, x, y): if not x or not y: yield (x, y) return if arr[x-1][y] == arr[x][y] and arr[x-1][y-1] == arr[x][y] and arr[x][y-1] == arr[x][y]: yield tuple((x, y)) yield from find_index(arr, x-1, y-1) if arr[x-1][y] == arr[x][y]-1 and arr[x-1][y-1] == arr[x][y]-1 and arr[x][y-1] == arr[x][y]-1: yield tuple((x, y)) yield from find_index(arr, x-1, y-1) if arr[x-1][y] == arr[x][y]: yield from find_index(arr, x-1, y) if arr[x][y-1] == arr[x][y]: yield from find_index(arr, x, y-1) arr is the array with all the numbers and x0 and y0 are the coords of the corner right bottom most number. The code works for all the cases in the video but i don't know if it will for others, can someone help me to test the code rigorously?
The whole code looks like this: str1 = 'abcvdefgh' str2 = 'bqdycvefgh' arr = [[0 for _ in range(len(str1))] for _ in range(len(str2))] for i in range(len(str2)): for j in range(len(str1)): if str2[i] == str1[j]: arr[i][j] = arr[i-1][j-1] + 1 else: arr[i][j] = max(arr[i-1][j], arr[i][j-1]) def find_index(arr, x, y): if not x or not y: yield (x, y) return if arr[x-1][y] == arr[x][y] and arr[x-1][y-1] == arr[x][y] and arr[x][y-1] == arr[x][y]: yield tuple((x, y)) yield from find_index(arr, x-1, y-1) if arr[x-1][y] == arr[x][y]-1 and arr[x-1][y-1] == arr[x][y]-1 and arr[x][y-1] == arr[x][y]-1: yield tuple((x, y)) yield from find_index(arr, x-1, y-1) if arr[x-1][y] == arr[x][y]: yield from find_index(arr, x-1, y) if arr[x][y-1] == arr[x][y]: yield from find_index(arr, x, y-1) letters_coord = reversed(list(find_index(arr, i, j))) longest = '' for i in letters_coord: longest += str2[i[0]] print(longest)
doesn't matter if he got it from a book. what matters is whether he was able to explain it properly, so that someone new to DP can understand. His explanation is awesome.
hey friend , can u plz tell me the timing of the part in the video which your question is related about? Thanks a lot for commenting. I will surely solve ur doubt.
Vivek -- I don't know what I would do without your explanations. You are the best algorithms teacher on UA-cam. You are the best I've ever seen. Keep doing what you're doing, it's helping a lot of people!
i know im asking randomly but does anyone know of a method to get back into an instagram account?
I was stupid lost my login password. I would appreciate any tips you can give me.
Sir, Your videos on Dynamic programming are awesome. Please make following videos if possible, Sir :
1) Given a string, determine if a permutation of the string could form a palindrome.
2) Count All Palindrome Sub-Strings in a String
3) Find all distinct palindromic sub-strings of a given string
4) Longest common substring
5) Longest Palindromic Substring
6) Print all palindrome permutations of a string
7) Print all palindromic partitions of a string
One of the best Algorithm teachers available on you tube !! Simply ,loved it !!
Thanks Vivekanand for your nice video. In my opinion, you should provide some explanation to the audience about why
- choosing the diagonal cell + 1 in the case of two characters are the same (for example LCS(x[m], y[n]) = LCS(x[m-1], y[n-1]) + 1 and (m-1, n-1) is the diagonal cell position);
- choosing the max of the upper row, same column as LCS(x[m-1], y[n]) and same row, left column as LCS(x[m], y[n-1]) when two characters are different.
This video clear all confusion of LCS .
well explanation
Haven't seen better teacher than you. Thanks for your 📹 🙏🙏
The Algorithm code needs a correction as it can through array limit exception on line 4/5 T[i][j] = T[i-1][j-1]+1 when i=0 or j=0.
Great Explanation sir.This is really useful for many please dont stop this
Very well explained.It was easy to understand LCS after watching this video.
really you deserve it.you teaches in so simple and easy manner.
Please discuss the time complexities as well with each algorithm. That would be really helpful.
I like your explanations. Also its nice to see how you have changed since early videos like this till now. Looking forward to new videos soon.
sir, the question is
find the number of characters that can be removed in the given string to make it a palindrome. using dynamic programming
We have to return the count sir.
Eg :
input1:mabm
output1: 1(explanation: by removing b we get palindrome)
input2: abbbcdae
output2 : 3(explanation: by removing c,d,e we get palindrome)
your teaching style is very best
please tell why are u taking diagonal +1 if elements match and maximum of above and left elements if they are different....!!!!
In the first instance we were looking for common subsequence between ab and b, so if we already had the count of subsequence between a and null (which is diagonally top left of the current cell) and then included b (which is common to both and is the current cell), then the common subsequence would increase by 1 (0 + 1). So when we find a common character we look at what the count of the subsequence was before that character was included, we do this by looking at the value of the cell diagonally top left of the current cell
you are a beast please expain more topics on programming
Sir, I think you have to take the 2d matrix of size [str1.length+1][str2.length+1] and loops will be up to
How to stop sleepiness?
Give an algorithm. I want to wake up all day and night and study.
I heard that RedBull makes you awake or few hours.
Bro!!!!!😍.....itna ache se koi kese smjha skta hai.
Superb explaination 👍🌟
at the end of the video the algorithm is a little wrong because if i=0 and j=0 and str1[i]==str2[j] than you cant do T[i-1][j-1]. ty very much for the video though. really helped me
sir,your video is very easy to learn...sir please upload more videos on algorithm...please sir
Great explanation !!! But it would be great if you can explain how this algorithm is derived !!!
Great and simply explained
Thank you! Much better than the explanation in my textbook. However, I feel that you fail to explain why the logic works.
needs more explanation on why we compare the values of those two cells?
Wouldn't the complexity be O(nm), when n and m are the lengths of the two initial strings? (They need not be of equal length after all).
Sir your lectures are too good..air can u please upload the videos for prime and dijaktra algorithm
Very nice explaination
You are best. I really mean it.. Keep it up.
Easily understood sir....Thank you
sir plzz make a video on SHORTEST UNCOMMON SUBSEQUENCE using dynamic programming.
Good man. UR great explainer
Thanks
Please post the logic to calculate lcs string as well.
sir please make a video on egg dropping puzzle
Sir, please make some videos on graph like finding out the number of connected islands and all! Thanks!
Please make a video on Binomial Tree and Binomial Heap and its operation with example
Sir, but the program you wrote only makes the matrix ready....but it doesn't tell about How to form the corresponding lcs STRING from matrix.. Thus this video is amazing but incomplete
Please reply to my query sir..as the complete coding solution for it is very important... and without it the video is incomplete
Great explanation!
thanks you so much sir
great explanation
Very nice Sir
I tried to write code to find the letter themselves and i came up with this:
def find_index(arr, x, y):
if not x or not y:
yield (x, y)
return
if arr[x-1][y] == arr[x][y] and arr[x-1][y-1] == arr[x][y] and arr[x][y-1] == arr[x][y]:
yield tuple((x, y))
yield from find_index(arr, x-1, y-1)
if arr[x-1][y] == arr[x][y]-1 and arr[x-1][y-1] == arr[x][y]-1 and arr[x][y-1] == arr[x][y]-1:
yield tuple((x, y))
yield from find_index(arr, x-1, y-1)
if arr[x-1][y] == arr[x][y]:
yield from find_index(arr, x-1, y)
if arr[x][y-1] == arr[x][y]:
yield from find_index(arr, x, y-1)
arr is the array with all the numbers and x0 and y0 are the coords of the corner right bottom most number.
The code works for all the cases in the video but i don't know if it will for others, can someone help me to test the code rigorously?
The whole code looks like this:
str1 = 'abcvdefgh'
str2 = 'bqdycvefgh'
arr = [[0 for _ in range(len(str1))] for _ in range(len(str2))]
for i in range(len(str2)):
for j in range(len(str1)):
if str2[i] == str1[j]:
arr[i][j] = arr[i-1][j-1] + 1
else:
arr[i][j] = max(arr[i-1][j], arr[i][j-1])
def find_index(arr, x, y):
if not x or not y:
yield (x, y)
return
if arr[x-1][y] == arr[x][y] and arr[x-1][y-1] == arr[x][y] and arr[x][y-1] == arr[x][y]:
yield tuple((x, y))
yield from find_index(arr, x-1, y-1)
if arr[x-1][y] == arr[x][y]-1 and arr[x-1][y-1] == arr[x][y]-1 and arr[x][y-1] == arr[x][y]-1:
yield tuple((x, y))
yield from find_index(arr, x-1, y-1)
if arr[x-1][y] == arr[x][y]:
yield from find_index(arr, x-1, y)
if arr[x][y-1] == arr[x][y]:
yield from find_index(arr, x, y-1)
letters_coord = reversed(list(find_index(arr, i, j)))
longest = ''
for i in letters_coord:
longest += str2[i[0]]
print(longest)
Would you please provide detailed pseudo code for back tracking? I would appreciate it.
Thank you for sharing it.
youtube please increase the speed by default by 3 for vivekanand khyade's videos.
By the way very well explained sir.Thanks.
document.getElementByTagName("video")[0].playbackRate = 3.0; paste this snippet in your console and you'll see the magic.
Plz make a video on Count the number of palindromic subsequnces of the given string.
actually you have done in reverse order , you should make matrix first and then derive the relations
what DSA books do you read ? How did you become so fluent in DSA this way ?
thank you sir very nicely explained
thanks gaurav...more videos are lined up...
Please make a video on LONGEST INCREASING SUBSEQUENCE
Thanks a lot, man.
Please make video to print the LCS string
But we can't use this method if the size of strings are very large right?
From cell b and r..assume if first row consists of all ones ie both are same den how vl u select?
What's the space complexity?
nicely explained....:)
how do we know the size of our 2d list is it len(str1 * lenstr2)
Hello Sir
can you please post the video for suffix tree?
Can you please explain how did you come up with this algorithm approach?
doesn't matter if he got it from a book. what matters is whether he was able to explain it properly, so that someone new to DP can understand. His explanation is awesome.
why @11:12 he is so angry on me.................lol
Thank you sir
Why 2D matrix? why diagnol+1? why max?
Sir maza aagya pash k
sir how are you choosing the adjacent element max
hey friend , can u plz tell me the timing of the part in the video which your question is related about? Thanks a lot for commenting. I will surely solve ur doubt.
Hello Sir, 2 doubts.
1) If the result matrix is below, how to find the length which we need to find ?
Result matrix:
0 0 0 0 0 0 0 0
0 0 1 1 1 1 1 1
0 0 1 1 2 2 2 2
0 0 1 1 2 2 2 2
0 0 1 1 2 3 3 3
0 0 1 1 2 3 3 4
0 0 1 1 2 3 3 4
0 0 1 1 2 3 3 4
2) How to print the result string ?
thanks
sir ji word kese niklega yeh to btaya hi nhi
video starts 7:59
Reallyy You too specila in Teaching!!!!!!!!!!!!!!!!!!!
stupid way of explaining things without giving the proper algorithm , where is the optimal substructure ? where is the proof of correctness ?
why don't you google that
@@vimalsheoran8040 its a valid criticism, its what many people watch these videos for