Summarization: 1. Generate all subsets and add size of k into the ans 2. discard all the subsets more than size of k 3. skip the combinations which may not have chance to get of k elements.
@DPCODE72
2 жыл бұрын
Really.........Now I would start enjoying with Recursion from when Fraz bhaiya would start teaching about Recursion!!......Thanks alot bhaiya!!
@de_ansh
2 жыл бұрын
Thanks for the lectres bhaiya, I understood the whole thing, Here is the summary for today's lecture.. 1. Think of generating all the subsets of size k, 2. Think of the base case carefully(it can help us optimize the code) 3. Use the I&I method(include and ignore )
@sidhant_khamankar
2 жыл бұрын
I think space complexity will also be O2^n as in worst case 2^n recursion calls will be stored in recursion call stack
@SnapCodes
Жыл бұрын
for recurtion its n and for prepareing the final result 2d array its 2^n
@Sandeep-zd6dq
2 жыл бұрын
Although I have never used that smaller condition but it really gives a lot more clarity and one thing also that this pick/non-pick strategy will always used when your answer is of smaller size as compared to input because then only you have the option to not-pick otherwise if it would be the permutations then answer is of same size therefore you can’t use it there.
@bhuneshmeravi8411
2 жыл бұрын
i like your apriciation bhaiya
@kartikeyrai8258
2 жыл бұрын
Bhaiya ur lectures are awsome but can u plz make a video on "Time & Space complexity" as i am finding it difficult. And its a humble request to make the video before 31st May (ie before the Contest), if possible/-
@harshjain8596
2 жыл бұрын
In Combination problem we basically consider all subsets of size 2 , after that we start bounding the solution as soon as size of ans become equals to k we add that ans to our result and as the condition we get the required element is greater than the remaining element we return from that point ,these help in reducing the time complexity but worst case time complexity is same as O(2^n)
@shashankkr1008
2 жыл бұрын
1.base case 2.take the element 3.backtrack 4.ignore the element
@dhruvbharara4959
11 ай бұрын
Selecting all the subsets of size k value from n. 1.Take the element -> k-1 , Skip the element ->k. 2.Base conditions: (i) if we reach k==0, then push subset into ans and return. (ii) if k value is greater than remaining elements in n (n-i+1) then return. (iii) if current(i) value greater than n we return.
@arghya_0802
2 жыл бұрын
Summary: 1. This question is a variation of generating all possible subsets 2. Here we have been given a value k and n and we need to generate all possible subsets starting from i = 1 till i
@emtiazahmed5333
2 жыл бұрын
Love this❣️🥰 thank u i wanna be very thankful for u for making this summary pls make it daily i also try but i cant💔
@arghya_0802
2 жыл бұрын
@@emtiazahmed5333 Thank you so much for replying. Will try to make the summaries of every lecture. It will benefit the entire community of students learning the course
@emtiazahmed5333
2 жыл бұрын
@@arghya_0802 i will wait for your summary comment🥰 i totally new.. Its very beneficial for me❣️ thank u
@codeflix927
2 жыл бұрын
Bhaiya aapke Recursion ka video Dekh ke lagta hai ki, Sare Data Structure Chor Ke Kewal Recursion hi Padhu. It's amazing videos ❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤
@anuraggulati2167
2 жыл бұрын
lecture 11 done 😍😍😍👌👌🤞 waiting for the next episode 🖤🖤🖤🖤
@hiiiiiiii927
2 жыл бұрын
Done Day 11 start from i=1 and include the number meanwhile decrement k and increment i pop the element i and increment the i and if at any point i>n && k==0 add the subset to the ans arraylist and return it
@Abhishek-fo3fc
2 жыл бұрын
Done Understood❤✅
@priyanshjha6952
2 жыл бұрын
Really enjoyed solving the problem together.
@balajitarun5929
2 жыл бұрын
Hello Fraz, have you ever tried submitting the answers in Python or Java uploaded in github ?. I see the answers are not accepted even though everything seems to be right. I understand Platform should not matter but our logic building needs to improve and how we are solving the problem matters. If we see the test cases failing for every problem we do get demotivated and in such scenarios where you organize contests, other than c++ users won't even have a chance to win or even at least submit their answers. (Try submitting answer in other languages , in c++ it does not even bother about constraints but in other languages scenario is totally different)
@RajputAnkit11
2 жыл бұрын
who told u in cpp constraints dont bother people?
@balajitarun5929
2 жыл бұрын
@@RajputAnkit11 have you ever tried code studio with fraz c++ code ?. if not please do try. I don't see any constraints in his code. Although logic maters the most but my main concern here is about the platform which is not accepting code in python or java. In Code studio, C++ has better privileges Try submitting code other than c++ and you will figure it out.
@it_08amanagarwal35
2 жыл бұрын
Bro excellent lecture again and the intuition behind the question helps me to get the question done by me without seeing the solution ❤❤❤❤❤❤❤❤❤❤❤❤❤❤
@RaunakShrivastava
Жыл бұрын
Thanks Fraz for the entire recursion series.
@saipradeepkatakam9734
2 жыл бұрын
My Summarization: Selecting all the subsets of size k value from n. 1.Take the element -> k-1 , Skip the element ->k. 2.Base conditions: (i) if we reach k==0, then push subset into ans and return. (ii) if k value is greater than remaining elements in n (n-i+1) then return. (iii) if current(i) value greater than n we return.
@Dhruv61695
2 жыл бұрын
Algo : 3:30 Code : 10:30 Optimization : 17:50
@vishalgowrav
2 жыл бұрын
Episode 11 completed!🔥 Combination Here,the problem is same as the subsets problem but we need to generate the subsets of length k 1) Instead of pushing our subset inside the ans when i reaches n we can do this priorly but pushing the subset when the length of the subset equals k so by this we can stop the growth of tree this will reduce the run time(Time complexity slightly) 2)If our required elements is greater than remaining elements ie If k>n-i+1 then there is no sense of skipping elements so we need to return Eg:-When k is 10 and i is 11 and n is 20
@beTheChange12
7 ай бұрын
amazing explanation bhaiya because of you I am loving recursion
@ujalavarshney480
2 жыл бұрын
Kal iss sem ka last exam hai But still I am watching videos 😍
@hritikasharma62828
2 жыл бұрын
How many lectures for recursion are remaining? Please please tell
@webtechnology6439
2 жыл бұрын
This series is verry helpfull and i read verry more understanding so i will place in 30 days. ❤🔥❤🔥❤🔥❤🔥
@BurhanAijaz
2 жыл бұрын
Day 11 aaj itna jaldi post 🔥🔥
@nithins3895
2 жыл бұрын
Good Explaination bro, i tried and succeed, Consistency✌✌ #Day11
@aashishgupta9392
2 жыл бұрын
How many more recursion lectures?
@de_ansh
2 жыл бұрын
7 may be
@mdsufyankhan1029
2 жыл бұрын
Day 11 done ✅✅ Mast tha 🙂
@iamdhirajshastri
2 жыл бұрын
Thank you so so much Fraz Bhaiya for your every efforts towards us✨❤
@deroxanime5273
Жыл бұрын
''Combinations'' Prerequisite: Subset problem -- This is similar to subset problem which we have done earlier but the difference is just that in subset we wanted all the subsets but in this we just want the subsets of the specified size K. -- We have two choices either to consider the element or to skip the ith element, we will return the function once the number of element goes beyond the N. --To remove the larger subset we will put a condition i.e. we will return out function once k==0 and adding our subset into the ans. -- One more improvement is there to remove the unnecessary process when we have lesser elements remaining than the required K elements. E.g. we have skipped all the elements till 10 and we have N = 20, K = 10 so if we skip the 11th element too we will only have 9 elements left which is less than K = 10, we'll put a condition k > n-i+1 then return. This will improve our runtime. Time complexity: O(2^n) Space complexity: O(n)
@ratnasanjay
2 жыл бұрын
Thankyou bhaiya for this session
@webtechnology6439
2 жыл бұрын
Summarize first is the genrate all the posible and recuired subset and other is the efficient base case and bounded condition.
@alien65629
Жыл бұрын
summarization : if index is greater than n : return from it if length of subset greater than k return from it if required number of elements are greater than remaining number of elements return from it. above three are base conditions there are two ways to create a subset: one way :to choose i th element and ask the recursion to do the remaining task by decresing the k-required number of elements by 1 i.e k-1 pop the elements in the subset. other way : by ignoring the i th element and ask recursion to do the remaining task by keeping the k to be unchanged bcoz we didnot consider any element in the subset.
@AkshayKumar-qo2yn
2 жыл бұрын
Notes: Problem is somewhat similar to subset problem, but here we can limit the recursion tree as per the provided value of k. The think to note is extra optimisation that we applied in the end to furthur limit the size of the recursion tree, in order to further remove time complexity. Time complexity = O(2^N) (since big O notation represents upper bound hence we can keep this as time complexity, though the actual run time complexity will always be less) Space Complexity = O(N) Not considering the size of result array.
@avadhutlohar5181
2 жыл бұрын
#EP_11 completed Consistency_OP 🔥🔥🔥
@aryanbhardwaj6252
2 жыл бұрын
In the last base condition where we're avoiding very short subsets, the base condition should be (subset.size()+n-i+1 < k)
@Hariharan-uy7ob
2 жыл бұрын
Make video for vector concept I got error while try to run the code on another compiler
@maazulhaque7293
2 жыл бұрын
Episode -11 Completed
@TravelTracksByDebo
2 жыл бұрын
wonderful explanation recursion looking easy
@webtechnology6439
2 жыл бұрын
Identify the problem is solved using this algorithm . ist is the finding label word and range 1 to n and 2nd is the exhitibition k and if word is present combination so better understand is type of problem solve using this recursion algorithm.
@rakeshbabu4790
2 жыл бұрын
Where can I practice questions on recursion...or watching your lectures are enough??
@dashundev1586
2 жыл бұрын
Need to watch it again
@vinaykamble162
2 жыл бұрын
Complete Day 11 ❤️
@chiragkarnwal6740
2 жыл бұрын
Thanks for the lectures and all your efforts sir🧡🧡🧡🧡🧡
@Abc-lr4bf
Жыл бұрын
Very nice explanation , thanks
@pulkitgupta2659
2 жыл бұрын
summary of combination: 1. find powerset by using recursion ( include item and then exclude item) 2if index size greater than size of value array, return 3if no of combination (k) equal to zero , add sunset of array into result array 4if no of required combination greater than no of given element,return as it will not fulfill condition anyway k>(n-i+1)
@user-jz2uw1pk9t
7 ай бұрын
Nice
@manikgoel9953
2 жыл бұрын
Thanks bhaiya
@pritishpattnaik4674
2 жыл бұрын
bhaiya I have thought of a base case where if the subSet size is equal to k then we will save the ans and return ? Is this correct ?
@sheelaggarwal028
2 жыл бұрын
can you please dry run this whole code, not the recursion tree but every iteration?
@sheelaggarwal028
2 жыл бұрын
For the first solution, initially i=1 and k=2, then i=2 and k=1, then i=3 and k=0, now again the recursive call is made, and now i=4 and k=-1, then i=5 and k=-2. Now the if condition says if(i>n) here 5 is greater than 4, so the condition is true. Moving to the next if statement (k==0) but the value of k is -2, so how it is being done now, i am confused from this step.
@codeByteLH
6 ай бұрын
Summary: 1.Approach started with either we can take ith ele or skip 2. For optimisation we have to consider that no of element in subset should not more than value of k 3. Dry run for Better understanding
@abhishekdwivedi-ll5ky
Жыл бұрын
Bhaiya ye jo 3re base condition hai ye to galat lag rhi hai... recursion tree bnane ke baad bhi galat aa rha hai ... Plzz guide
@divyanshsagar
2 жыл бұрын
Episode 11 done! 🔥🔥
@singla__sisters2928
2 жыл бұрын
Nice explanation 👌
@mohdumar6990
2 жыл бұрын
Bhot zbrdst
@ashokbhardwaj681
2 жыл бұрын
Bhaiya beginner DSA series kab aayegi pls 🙏 reply krna
@nishigupta2501
2 жыл бұрын
Great video😀
@devanshgupta9283
2 жыл бұрын
Nice explain.
@chrono1339
2 жыл бұрын
May you explain the python code please?
@sagarpokhriyal6926
2 жыл бұрын
Lecture 11 Done ☑ #dsabyfaraz🌠
@afrahthahir7179
2 жыл бұрын
pls tell me how you will find remainingelements = n-i+1 ?
@rajankhunt7002
2 жыл бұрын
Good Video
@RajputAnkit11
2 жыл бұрын
yes done day 11 🙌❤️
@anshumankumar9342
2 жыл бұрын
Day 11 Done bhaiya👍
@shalimar_mehra
2 жыл бұрын
Present ! ✅🙌
@pritishpattnaik4674
2 жыл бұрын
My summarization : so here if we take the ith element , the add it to ur data structure and call the helper function recursively for the i+1th element with k-1 as we have toom that element , if we don't pick the ith element then we would backtrack and pop it out from our data structure and and call recursively for i+1th element with k as we have not taken it, and if the k reaches 0 then add it to ans vector and if i exceeds n simply return
@rahulkar5256
2 жыл бұрын
Complete and conquer..
@sparshgarg8362
Жыл бұрын
How is n-i+1 remaining elements?
@sanketbhagat1222
2 жыл бұрын
Thankyou bhaiya.
@Zeeshan_Ahmad-
2 жыл бұрын
BSc se hoon big product company ke liye pay after placement program OR MCA from local colleges ?
@Gauravkumar-kc6xh
2 жыл бұрын
Great
@dhruvchopra5727
9 ай бұрын
Isn’t the complexity k*2^n ?
@ayan84240
2 жыл бұрын
First
@LearnYardYT
2 жыл бұрын
Thanks ☺️❤️
@isikamaiti9116
2 жыл бұрын
11 Done ✅
@shashibarnwaldavmo
2 жыл бұрын
thank you
@pratyekmotivation7481
11 ай бұрын
--> Here is my approach where we will not call the function if we dont require we will be calling only if there is a possibility to generate subset of required size.i used an approach which is similar to that of permutations. This code took only 160 ms runtime. by the way this playlist is very helpfull in developing the concept of recursion and actually apply it on our own approach thank you bhaiya for this amazing content. :) #include void solve(vectora,vector&ans,int k,vectors){ if(a.size()==k){ ans.push_back(a); } else{ int d= a.size()-1; if(d
@hrithikrudra4292
2 жыл бұрын
Syllabus of tomorrow's contest bhaiya?
@yashbahuguna8135
2 жыл бұрын
done for day 11😊
@aveermukherjee6419
2 жыл бұрын
Just a slight modification to the subset problem .This is the code :- #include void combination(int i,int n,int k,vector &combi,vector &combi_ans,vector &arr) { if(i==n) { if(combi.size()==k) { combi_ans.push_back(combi); } return; } else { combi.push_back(arr[i]); combination(i+1,n,k,combi,combi_ans,arr); combi.pop_back(); combination(i+1,n,k,combi,combi_ans,arr); } } vector combinations(int n, int k) { // Write your code here. vector arr; for(int i=1;i
@aveermukherjee6419
2 жыл бұрын
@Ayush Chopra What is a base subset?Subsets are meant to change.I think u r talking about the base set which is not changing it is vector &arr. not combi. combi is used to generate subsets so it should change.
@aveermukherjee6419
2 жыл бұрын
@Ayush Chopra It will keep track of every subset by backtracking.
@rakeshbabu4790
2 жыл бұрын
Bro...in your journey...on you first go...did u solve generating permutations.. generating subsets kind of problems.?
@vinodthakar4561
2 жыл бұрын
baas video dekhte jaa thode din baad samaj ayega ye topic kyu choose kiye tha
@rakeshbabu4790
2 жыл бұрын
@@vinodthakar4561 please say in English...I don't know hindi
@Lucifer-xt7un
2 жыл бұрын
Consistency ++
@AnandKumar-ji6wb
2 жыл бұрын
more video
@ankittjindal
2 жыл бұрын
🔥🔥🔥🔥❣️
@mahedihassan3956
8 ай бұрын
Exam in 2 days now i am watching it with 2× speed....😅😅😅
@prakharagarwal4933
2 жыл бұрын
Done✅
@vibhutiraina8976
Жыл бұрын
These are subsequences, not subsets.
@bhanuprakashreddy3912
2 жыл бұрын
Combinations Given : K=2 -->Boundation (So ,Subset with Combination of 2 nos.) Idea point : Either selecting i'th element into the subset or Ignoring it Base condition :(i) till I reaches the last element (ii) if size of subset == k(Constraint/Condition) Dont go through it further IF TAKE push the i'th element into the subset Ask recursion to do the further task from I+1 and also pass k-1 as I have selected one element already once. IF SKIP pop that out and ask the recursion to do the similar further task. if(k==0)..ie: size of k=2 Then push it into the ans. and if (I>N) then return Also if ( k>n-i+1 ) then return as we can't further form a subset of desired size.
@samqureshi9415
2 жыл бұрын
Yaar mai socha tha series ikdam basic se rahegi dsa ki per achanak se recursion mai vector aa gaya phir string aa gaya aab wo shamjna padd raha hai alag se toh thoda demotivate ho gaya hu
@LearnYardYT
2 жыл бұрын
Yahi to hustle hai. Karo ye sab
@anshumankumar9342
2 жыл бұрын
ye sb choti chiz se Darna nhi h . Remember one thing "Jab tk todenge nhi tbtk chhodenge nhi"😅😅
@aveermukherjee6419
2 жыл бұрын
Sir this is the solution to your homework problem:- #include void sumcomb(int i,int n,vector &arr,vector &comb,int sum,vector &ans) { if(sum==0) { ans.push_back(comb); return; } else if(sum
@hikikomori9387
2 жыл бұрын
I tried and came up with this code, got accepted into the leetcode, can someone please review and tell me if its a good idea to show this solution in an interview ? public static List combine(int n, int k) { List list = new ArrayList(); for(int i=1; i
Пікірлер: 110