String permutation algorithm | All permutations of a string

  Рет қаралды 367,310

Techdose

Techdose

Күн бұрын

Пікірлер
@techdose4u
@techdose4u Жыл бұрын
🟣 JOIN our 𝐋𝐈𝐕𝐄 𝐢𝐧𝐭𝐞𝐫𝐯𝐢𝐞𝐰 𝐭𝐫𝐚𝐢𝐧𝐢𝐧𝐠 𝐩𝐫𝐨𝐠𝐫𝐚𝐦 through whatsapp query: +91 8918633037 🔴 𝐂𝐡𝐞𝐜𝐤𝐨𝐮𝐭 𝐚𝐥𝐥 𝐨𝐮𝐫 𝐂𝐨𝐮𝐫𝐬𝐞𝐬: techdose.co.in/
@prashantagarwal8877
@prashantagarwal8877 2 жыл бұрын
I always had a fear when it comes to find permutation, you have explained it in a very simple way. Thanks a lot!!!!
@lancema2894
@lancema2894 4 жыл бұрын
Very clear explanation. Finally understand why we need the backtracking after the recall of permute. Thank you very much.
@techdose4u
@techdose4u 4 жыл бұрын
Welcome :)
@vcfirefox
@vcfirefox 2 жыл бұрын
Love it. Time and time again, I come back to your channel when I need a REALLY good grasp of something that is not explained well in leetcode. Thank you!
@faizanzahid490
@faizanzahid490 5 жыл бұрын
Those who have tried coding knows the complexity of outputs for this case where elements of string is not repeating Thumbs up bro
@techdose4u
@techdose4u 5 жыл бұрын
Thanks :)
@mitchellbaylor8132
@mitchellbaylor8132 3 жыл бұрын
Pro trick : you can watch series at flixzone. Me and my gf have been using it for watching lots of of movies these days.
@graysonalan44
@graysonalan44 3 жыл бұрын
@Mitchell Baylor Definitely, have been watching on flixzone} for months myself =)
@hectorotis512
@hectorotis512 3 жыл бұрын
@Mitchell Baylor Yup, been watching on Flixzone} for years myself :)
@alexanderamos9961
@alexanderamos9961 3 жыл бұрын
@Mitchell Baylor yup, have been using Flixzone} for since november myself :D
@bitbyte8177
@bitbyte8177 4 жыл бұрын
Dude you know what, your method is the most intuitive method I have seen on youtube. Awesome job!!
@techdose4u
@techdose4u 4 жыл бұрын
Thanks :)
@nagalakshmichithambaranath1147
@nagalakshmichithambaranath1147 4 жыл бұрын
Yes true.
@rhishishrivastava675
@rhishishrivastava675 7 ай бұрын
You are a magician, you can make someone believe in himself/herself and not give up on dreams. God bless you.
@aayushsugandh4036
@aayushsugandh4036 4 жыл бұрын
This perhaps used to be one of those problems, which I always use to try in my school life, but could never solve it using for loops, but now in grad life, it has changed!
@techdose4u
@techdose4u 4 жыл бұрын
:)
@swapnil1108
@swapnil1108 5 жыл бұрын
I saw this video and went on to explore your playlist and finally subscribed you..LOL. Awesome explanation. I wish you had a second part with DUPLICATE STRINGS.
@techdose4u
@techdose4u 5 жыл бұрын
Will do it later. I am loaded with question requests now :)
@JayDonga
@JayDonga 4 жыл бұрын
Your explanation of the permutation problem is better than most other explanations on the Internet.
@techdose4u
@techdose4u 4 жыл бұрын
Thanks :)
@Purple-e9c
@Purple-e9c 4 жыл бұрын
This is very helpful for me. Thank you. Very good presentation. Now I totally understand the string permutation. The dry run of algorithm is very helpful and impressive.
@techdose4u
@techdose4u 4 жыл бұрын
Thanks :) glad that you understood
@cityhunter1477
@cityhunter1477 2 жыл бұрын
Thank you! I saw so many blogs and videos with the tree and the code separate. Yours was the first to connect the tree to the code directly! Now I can understand what the swaps are doing exactly and how the iteration works.
@techdose4u
@techdose4u 2 жыл бұрын
Nice 😊
@olgyish
@olgyish 4 жыл бұрын
I was able to code this easily after watching your explanation. That was a great explanation.
@techdose4u
@techdose4u 4 жыл бұрын
Nice 😊
@m.p.3688
@m.p.3688 Жыл бұрын
I watched NeetCode explenation of this problem probably 5 times and could not understand how logic behind it actually relates to code solution. Watching this explenation helped me understand code behind the solution instantly, because logic presented in drawning explenation is simple and actualy demonstrates code logic.
@bhimsendabby
@bhimsendabby 4 жыл бұрын
I always confused with permutation, I mean how to implement permutation in coding but after your explanation, I got the logic of how to code this thank you Sir.
@techdose4u
@techdose4u 4 жыл бұрын
Welcome
@bhimsendabby
@bhimsendabby 4 жыл бұрын
@@techdose4u thanks a lot
@AparnaBushan
@AparnaBushan Жыл бұрын
By far the best explanation of this problem on you tube. Thanks much!
@Goku-ri3tl
@Goku-ri3tl 7 ай бұрын
Amazing!! This worked like a charm )) at my first try I have been trying for many days different tutorials but no one explained as good and easy as you, Thank you so much
@techdose4u
@techdose4u 7 ай бұрын
Great :)
@sunilkumaryadav3194
@sunilkumaryadav3194 2 жыл бұрын
This is for the first time I try to understand it and You nailed it. Thank you
@shreyasvishwakarma8979
@shreyasvishwakarma8979 3 жыл бұрын
Today is 2022 and you made this in 2019 . Like 3 year still 96.2k subscribers . You deseve 1M sadly you and i know indians love clickbait stuff . 96.2K shows you are best at teaching not at Clickbait . Keep up the good work sir : )
@techdose4u
@techdose4u 3 жыл бұрын
Thanks 😊
@asmartguycodename4721
@asmartguycodename4721 Жыл бұрын
Shut up goofball
@jithiny6953
@jithiny6953 2 жыл бұрын
Very nicely explained. I saw many videos to understand this, but this was super clear
@aadridanand
@aadridanand Жыл бұрын
from all the explanation this is one of the most easiest way one can explain,thanks👏👏
@shivamgupta3293
@shivamgupta3293 3 жыл бұрын
Everytime I found best explanation only in this channel. Thanks Man
@techdose4u
@techdose4u 3 жыл бұрын
Welcome :)
@feelgood0108
@feelgood0108 5 жыл бұрын
awesome explaination sir.Now I got clear understanding on what is backtracking.Thank you so much
@debasishpatnaik294
@debasishpatnaik294 4 жыл бұрын
Finally Understood it..thanks a lot for the detailed explanation of the algo..
@techdose4u
@techdose4u 4 жыл бұрын
Nice :)
@thesadanand6599
@thesadanand6599 4 жыл бұрын
I am floored, dude u earned a sub...
@techdose4u
@techdose4u 4 жыл бұрын
Thanks :)
@SandeepGaneshD23BRS107
@SandeepGaneshD23BRS107 4 ай бұрын
a tough concept simplified ... Thanks sir
@swanhtet1
@swanhtet1 2 жыл бұрын
This is the best explanation on this problem.
@duyle-ui4ul
@duyle-ui4ul 2 жыл бұрын
Best explaination I've ever took. Really appriciate it!
@rutachaudhari5774
@rutachaudhari5774 4 жыл бұрын
Thank you so much, your explanation is very easy than others. Its very difficult to understand permutation with recursion, but this makes it easy
@techdose4u
@techdose4u 4 жыл бұрын
Thanks 😊
@ozzyfromspace
@ozzyfromspace 4 жыл бұрын
I forgot how to write permutations but need to write such an algorithm for a project I'm doing in recreational maths. Thanks for explaining it :) I was thinking "recursion" so I'm glad you did that approach. I'm gonna write something up in python now
@techdose4u
@techdose4u 4 жыл бұрын
Good luck
@gpavansai7207
@gpavansai7207 2 жыл бұрын
Thank You so much, your lecture is very clear and elaborative.
@samudrasen2935
@samudrasen2935 3 жыл бұрын
Really wonderful explanation .all the doubts in string permutations got cleared.
@saisrisai9649
@saisrisai9649 4 жыл бұрын
The best tutorial ever..
@techdose4u
@techdose4u 4 жыл бұрын
Thanks :)
@prateekrajput2646
@prateekrajput2646 3 жыл бұрын
you explained with god level
@techdose4u
@techdose4u 3 жыл бұрын
Thanks :)
@rohit210995
@rohit210995 5 жыл бұрын
I think this method won't work for duplicates. It will count the duplicates as separate characters. Eg.- ABAC. In this case total no. of permutations possible would be 12 (4!/2!). However, if we follow this method it will end up 24 (4!) combinations, simply because it counts the first and the second occurrence of A as different alphabets. Meaning - in ABAC, if A in the first place is swapped with A in third place we end up with the same string ABAC, whereas the above logic treats them as different. (This can be taken care of if we use a counter for each character).
@gkeranna3543
@gkeranna3543 2 жыл бұрын
If you want to remove duplicates. just you will add all Strings into HasSet.
@georgesaab7609
@georgesaab7609 Жыл бұрын
store all results in a vector of strings and then youd be able to filter the duplicates
@UnknownLearner-od3qn
@UnknownLearner-od3qn 6 ай бұрын
your videos are always awesome and ofcourse so much informative & easy to understand ... Thnx 🙏🙏
@ranusingh862
@ranusingh862 3 жыл бұрын
Best explanation I could ever get. 👏
@ashutoshbichare
@ashutoshbichare 4 жыл бұрын
Easier is(without swapping): def permut(str,k): if len(str)==0: print(k) else: for i in range(len(str)): permut(str[i+1:]+str[:i],k+str[i])
@markovujanic
@markovujanic Жыл бұрын
wow, this is very well explained, especially I liked how you wrote on branches swapping you do. Thanks a lot
@urvashisharma7415
@urvashisharma7415 3 жыл бұрын
interview in 20mins...thank god i watched this
@techdose4u
@techdose4u 3 жыл бұрын
You got it!!
@urvashisharma7415
@urvashisharma7415 3 жыл бұрын
@@techdose4u thank u so much for the reply 😭
@urvashisharma7415
@urvashisharma7415 3 жыл бұрын
@@techdose4u Update: I got placed 😭
@mallikarjunpidaparthi
@mallikarjunpidaparthi 4 жыл бұрын
Wow... Clear explanation thanks brother : )
@techdose4u
@techdose4u 4 жыл бұрын
Welcome
@lucasbollella8487
@lucasbollella8487 Жыл бұрын
Thanks man, this video is really clear.
@techdose4u
@techdose4u Жыл бұрын
Glad it helped!
@VishalKumar-pk9ek
@VishalKumar-pk9ek 4 жыл бұрын
bahoot sahi explanation bhai😍😍😍😍
@techdose4u
@techdose4u 4 жыл бұрын
Thanks :)
@OP-yw3ws
@OP-yw3ws Жыл бұрын
This explaination is so easy to understand, thankyou!
@uttarandas8113
@uttarandas8113 3 жыл бұрын
1:15 what you need to understand!!! Thanx sir! I don't know why was this video not on top of suggestions =(
@ChandraShekhar-by3cd
@ChandraShekhar-by3cd 4 жыл бұрын
The visualization technique is quite helpful in understanding the algorithms .. Thanks a lot TECH DOSE :)
@techdose4u
@techdose4u 4 жыл бұрын
Thanks
@harshpanwar1550
@harshpanwar1550 3 жыл бұрын
Beautifully Explained Sir...Thanks a lot!!!
@rakshitsingh7504
@rakshitsingh7504 4 жыл бұрын
Thank you for explaining it, best of all I have seen.
@techdose4u
@techdose4u 4 жыл бұрын
Welcome :)
@b_rza
@b_rza 2 жыл бұрын
Great explanation. Thank you very much
@techdose4u
@techdose4u 2 жыл бұрын
Welcome 😁
@idontusecryptocurrency5870
@idontusecryptocurrency5870 3 жыл бұрын
Thanks sir.Your video was very good for a beginner
@techdose4u
@techdose4u 3 жыл бұрын
Great ❤️
@TOMGAMING-hy9hi
@TOMGAMING-hy9hi 4 жыл бұрын
Comment to banta hai boss for your explanation.....
@techdose4u
@techdose4u 4 жыл бұрын
Thanks
@kanhashukla6265
@kanhashukla6265 4 жыл бұрын
Thanks for the efforts man. This helps a lot. Keep up the good work.
@techdose4u
@techdose4u 4 жыл бұрын
Welcome :)
@tanusrisaha4873
@tanusrisaha4873 4 жыл бұрын
Finally understood recursive tree...awesome explanation..going to watch ur full playlist :)
@techdose4u
@techdose4u 4 жыл бұрын
Thanks :)
@kartikenbarnwal
@kartikenbarnwal 3 жыл бұрын
😍thak gya hu vro iski video like kr krke
@techdose4u
@techdose4u 3 жыл бұрын
:)
@priyanshuchaurasiya6184
@priyanshuchaurasiya6184 2 жыл бұрын
Thanks a lot♥♥ , your explanation is so good the just looking at your pseudo code I am able to code the problem.😊😊
@mr-engin3er
@mr-engin3er 2 жыл бұрын
Good explanation. Thanks for sharing. Keep it up. All the best for your future.
@jimmy-dk9lo
@jimmy-dk9lo 4 жыл бұрын
My mind is exhausted, but still I am able to understand, thanks a lot.
@techdose4u
@techdose4u 4 жыл бұрын
Welcome :)
@mohdshahzaib4094
@mohdshahzaib4094 3 күн бұрын
Thanks, Very good explanation sir.
@techdose4u
@techdose4u 3 күн бұрын
welcome
@justanotherlearner1404
@justanotherlearner1404 3 жыл бұрын
bhai bahut easily explain karte ho ......thank you so much
@techdose4u
@techdose4u 3 жыл бұрын
Welcome
@jaskiranmalhotra989
@jaskiranmalhotra989 3 жыл бұрын
This is actually the best explaination thnx alot sir.
@shailendrakk6226
@shailendrakk6226 3 жыл бұрын
Awesome explanation.Loved it
@techdose4u
@techdose4u 3 жыл бұрын
Thanks :)
@adityaojha2701
@adityaojha2701 4 жыл бұрын
Thanks a lot sir. You explained very well!!
@techdose4u
@techdose4u 4 жыл бұрын
Welcome ☺️
@suryakangeyan9751
@suryakangeyan9751 3 жыл бұрын
just found this gem :) , subscribed !
@techdose4u
@techdose4u 3 жыл бұрын
Thanks :)
@kushalappaca5324
@kushalappaca5324 3 жыл бұрын
Excellent explanation! Great work👌👌
@techdose4u
@techdose4u 3 жыл бұрын
Thanks
@kushalappaca5324
@kushalappaca5324 3 жыл бұрын
@@techdose4u I have one doubt though.... Why do we need the second swap function? It works without that too... Recursion works that way right?
@jugsma6676
@jugsma6676 4 жыл бұрын
This is so much clear explanation indeed.
@techdose4u
@techdose4u 4 жыл бұрын
Thanks
@theerans723
@theerans723 2 жыл бұрын
Very helpful brother. 🤞🏻Thanks
@vengateshwarang
@vengateshwarang 10 ай бұрын
Awesome, thanks for the good explanation
@debanjanpradhan7633
@debanjanpradhan7633 2 жыл бұрын
Great Explanation, Thanks a lot!
@techdose4u
@techdose4u 2 жыл бұрын
Welcome :)
@algotorials81
@algotorials81 4 жыл бұрын
swap(a+l,a+i); permute(str,l+1,r); if [l=0, i=0 A-A swaps] , [ l=1, i=1 B-B swaps] , [l=3, i=3 and so C-C] should swap ? at 2:31 as l changes on each recursive call so do i. How is it getting swapped i cannot catch ?
@Ashok-oe3lo
@Ashok-oe3lo 5 жыл бұрын
really a great explanation and its easy to understand...thanks for all your time. It will be helpful if you can also explain how to handle if the character is duplicate. Thanks
@techdose4u
@techdose4u 5 жыл бұрын
Yea you are ryt. This doesn't handle duplicate characters. I will try to make this case in future.
@bowenyi-kj3vr
@bowenyi-kj3vr Жыл бұрын
This is a great explanation!!!!!!
@nagalakshmichithambaranath1147
@nagalakshmichithambaranath1147 4 жыл бұрын
The best explanation.
@techdose4u
@techdose4u 4 жыл бұрын
Thanks :)
@myyoutubeisthis
@myyoutubeisthis Жыл бұрын
thank you very much sir for this explanation
@ITEngineer99
@ITEngineer99 5 жыл бұрын
Excellent bro...keep uploading..I like your teaching..and great content....:)
@techdose4u
@techdose4u 5 жыл бұрын
Thanks :)
@eugeneyap4208
@eugeneyap4208 2 жыл бұрын
Love the explanation, I have a better visualization now.
@ibknl1986
@ibknl1986 2 жыл бұрын
Thanks
@harryhenderson3636
@harryhenderson3636 Жыл бұрын
Inspired by Wikipedia I have developed my own method of generating permutations which is similar to this - they might actually be the same thing. Here's how mine works. Suppose we have ABCD - the situation would look like this: 1 ABCD Now repeatedly copy line 1 and move B to the left until it can't move anymore. So we have: 1 ABCD 2 BACD Now we move on to C. Now we have to copy both lines 1 and 2 and move C. 1 ABCD 2 BACD copy of line 1 moving B 3 ACBD copy of line 1 moving C 4 CABD copy of line 1 moving C Now that C is all the way to the left we start copying line 2. 5 BCAD copy of line 2 moving C 6 CBAD copy of line 2 moving C C is all the way to the left again but now we have to change characters or we will get duplicate permutations. Whenever we change a character we start copying line 1 again. If you study the permutation list numbers you will notice the character changes take place based on the factorial numbers: 1!, 2!, 3! = 1, 2 and 6. Starting on line 2 we begin moving B, on line 3 we start moving C and on line 7 we start moving D. Subtracting 1 from these numbers gives us 1, 2 and 6. Here is my example extended to make sure the pattern is clear. 1 ABCD 2 BACD copy of line 1 moving B 3 ACBD copy of line 1 moving C 4 CABD copy of line 1 moving C Now that C is all the way to the left we start copying line 2. 5 BCAD copy of line 2 moving C 6 CBAD copy of line 2 moving C 7 ABDC copy of line 1 moving D 8 ADBC copy of line 1 moving D and so on...
@pawanlok1776
@pawanlok1776 2 жыл бұрын
thank you , this video help me a lot to understand the topicc
@Sejal-Maheshwari-2002
@Sejal-Maheshwari-2002 4 жыл бұрын
Very well explained. Thank you !
@techdose4u
@techdose4u 4 жыл бұрын
Welcome
@hacker3191000
@hacker3191000 4 жыл бұрын
dude amazing video man, now i understand the recursion tree also, i thought your channel's name was TECH DOSA initially lol
@techdose4u
@techdose4u 4 жыл бұрын
Shit 🤣
@shubhampandey7177
@shubhampandey7177 3 жыл бұрын
good explanation. It really helped!!!
@techdose4u
@techdose4u 3 жыл бұрын
Welcome :)
@LegitGamer2345
@LegitGamer2345 4 жыл бұрын
FINALLY UNDERSTOOD!!!!!!
@techdose4u
@techdose4u 4 жыл бұрын
Nice :)
@atulkumar-bb7vi
@atulkumar-bb7vi 5 жыл бұрын
Wow! I found this explanation very helpful and simple to understand. Thanks for this!
@techdose4u
@techdose4u 5 жыл бұрын
Welcome :)
@glazeds0n
@glazeds0n 4 жыл бұрын
very good explanation,,, as always
@techdose4u
@techdose4u 4 жыл бұрын
Thanks
@khakr01
@khakr01 5 жыл бұрын
Superb! Keep teaching
@techdose4u
@techdose4u 5 жыл бұрын
Thanks :)
@seetharaman6603
@seetharaman6603 2 жыл бұрын
You are great. Nice and thank-you
@vinit__rai
@vinit__rai 5 жыл бұрын
keep posting more videos....we all are support u...
@techdose4u
@techdose4u 5 жыл бұрын
Thanks :)
@ganeshjaggineni4097
@ganeshjaggineni4097 Ай бұрын
NICE SUPER EXCELLENT MOTIVATED
@techdose4u
@techdose4u Ай бұрын
Great :)
@debashisdas6593
@debashisdas6593 2 жыл бұрын
very good explanation !!
@ququ9609
@ququ9609 2 ай бұрын
It is amazing video for beginner
@techdose4u
@techdose4u 2 ай бұрын
Nice :)
@amrmoneer5881
@amrmoneer5881 3 жыл бұрын
this is a beautiful video. bless ur indian voice mate :D
@techdose4u
@techdose4u 3 жыл бұрын
Thanks :)
@amanrana1553
@amanrana1553 3 жыл бұрын
Nice explanation bro keep it up👍
@kunjanshah_sr
@kunjanshah_sr 4 жыл бұрын
public class Permutations extends Activity { String TAG = Permutations.class.getSimpleName(); char[] Res; int[] A; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); String input="ABC"; Res = new char[input.length()]; A = new int[input.length()]; perm("ABC".toCharArray(), 0); } void perm(char[] str, int k) { if (str.length == k) { Log.d(TAG, Arrays.toString(Res)); } else { for (int i = 0; i
@Cybernetic1
@Cybernetic1 5 жыл бұрын
Thanks bro...you are the best.
@shaamidrees6036
@shaamidrees6036 3 жыл бұрын
Thanks sir finally understood it
@biowar5539
@biowar5539 3 жыл бұрын
Really good explanation.
@priyasuhag6798
@priyasuhag6798 Жыл бұрын
salute you sir, thanks you so much to make it
@ДобушМаксим
@ДобушМаксим 7 ай бұрын
Thx ur video was of great help
@aodiogo
@aodiogo 3 жыл бұрын
Very well explained
@techdose4u
@techdose4u 3 жыл бұрын
Thanks
@hemanthsiripireddy8717
@hemanthsiripireddy8717 4 жыл бұрын
Thank you so much Perfect explanation 👌
@techdose4u
@techdose4u 4 жыл бұрын
Thanks :)
L12. Print all Permutations of a String/Array | Recursion | Approach - 1
19:07
Une nouvelle voiture pour Noël 🥹
00:28
Nicocapone
Рет қаралды 9 МЛН
Cheerleader Transformation That Left Everyone Speechless! #shorts
00:27
Fabiosa Best Lifehacks
Рет қаралды 16 МЛН
LeetCode was HARD until I Learned these 15 Patterns
13:00
Ashish Pratap Singh
Рет қаралды 712 М.
Solve Any Pattern Question With This Trick!
57:20
Kunal Kushwaha
Рет қаралды 2,5 МЛН
How to Code Combinations Using Recursion
22:26
Coderbyte
Рет қаралды 91 М.
Guess The Egyptian
34:57
Dose of Emirates
Рет қаралды 437 М.
Permutation Sequence | Leetcode #60
18:17
Techdose
Рет қаралды 57 М.
Lecture39: Permutations of a String || C++ Placement Course
21:50
CodeHelp - by Babbar
Рет қаралды 281 М.
5 Simple Steps for Solving Any Recursive Problem
21:03
Reducible
Рет қаралды 1,3 МЛН
How To Permute A String - Generate All Permutations Of A String
28:37
Back To Back SWE
Рет қаралды 111 М.
Permutations and Combinations Tutorial
17:41
The Organic Chemistry Tutor
Рет қаралды 3,5 МЛН
How I Got Good at Coding Interviews
6:29
NeetCode
Рет қаралды 1,7 МЛН