Recursion - Pattern Questions + Bubble Sort + Selection Sort

Поделиться
HTML-код
  • Опубликовано: 17 ноя 2024

Комментарии • 259

  • @KunalKushwaha
    @KunalKushwaha  3 месяца назад +4

    DSA + interview preparation playlist: ruclips.net/p/PL9gnSGHSqcnr_DxHsP7AW9ftq0AtAyYqJ

    • @WORK-HARD-jm4cg
      @WORK-HARD-jm4cg 3 месяца назад +1

      bro graphs and dp please

    • @karthikb975
      @karthikb975 2 месяца назад

      In one word your explanation and teaching and the content your providing is better than the paid courses. Thank you kunal sir your dsa course helping us a lot to learn the dsa in easy way. And also we are waiting for the course on DP and Graphs that no-one has created so far !!! so plese make that concepts also

  • @Tomharry910
    @Tomharry910 2 года назад +186

    Recursion is the part where even the most intelligent of folks struggle and give up programming. In India, I have personally seen intelligent people reluctant to share their knowledge out of hyper competetiveness. You don't know how many lives you're building by generously sharing this top level knowledge free of cost. God will always bless you for this selfless noble act, Kunal Sir 🙏

  • @nikolas8203
    @nikolas8203 2 года назад +28

    Gotta appreciate how you linked the pattern thing to bubble sort and selection sort...at first I was confused about it but then in a moment I was like "woah got it". Top-notch playlist

  • @realism2463
    @realism2463 2 месяца назад +6

    Dp bro please , u r the best teacher i got so far , and struggling in dp the most , want to study from you !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  • @MozhdehNourizadeh
    @MozhdehNourizadeh Год назад +9

    Kunal, I cannot express my gratitude enough. Your teaching has been exceptional and transformative for me. I have finally grasped the concept of recursion - something that eluded me until now. You are an incredible teacher and mentor. PLEASE PLEASE PLEASE teach us more subjects like Hashmap and Dynamic programming. I am eagerly looking forward to taking those courses as well. 🙏

  • @prasadm3614
    @prasadm3614 2 года назад +26

    Yes, as you mentioned we r waiting for that course on DP that no-one has created so far !!!

    • @KrishNamaste
      @KrishNamaste Год назад +1

      Same here!

    • @shantohossain1372
      @shantohossain1372 Год назад +1

      same here but it's more than one and half year gone!!

    • @udaysingh2929
      @udaysingh2929 9 месяцев назад +2

      still waiting

    • @prtk2verma
      @prtk2verma 4 месяца назад

      @@udaysingh2929 khada hu aaj bhi wohi....

    • @veeee5577
      @veeee5577 3 месяца назад +2

      still waiting

  • @senseiAree
    @senseiAree Год назад +7

    I'm not a Java Programmer but Getting inspired by you, I have created a new Hackerank Account and started solving the problem solving questions again but this time I am using Recursion only. I have had six stars in problem solving before but I always struggled on Recursion. Thanks a lot Kunal Sir. You gave me inspiration. My core weakness was permutation and combination... Today after watching your algorithm on Recursion: Subset... I implemented the code in C# and I started jumping out of enthusiasm when it ran successfully.. I also implemented dynamic programming to it so it doesn't repeat on the same characters in the string. I can't elaborate with words how thankful I am.

  • @saurabhjaswal21
    @saurabhjaswal21 2 года назад +15

    This playlist helps me a lot, thanks man for providing such a brilliant course

  • @mrwhosetheboss6876
    @mrwhosetheboss6876 3 года назад +6

    kunal beside programming your are really a good teacher like u started with patterns thats simillar to two sorting technique its amazing and really helpfull thanks

  • @preetidas9155
    @preetidas9155 2 месяца назад +2

    the best recursion playlist on RUclips🙌

  • @keshavdeosharma7222
    @keshavdeosharma7222 Год назад +2

    Thanks Kunal Bhaiya for sharing the knowldege.

  • @aryangupta6335
    @aryangupta6335 4 месяца назад

    Must say it is the best playlist for recursion over the internet so far ...

  • @ronitsharma0352
    @ronitsharma0352 8 месяцев назад +1

    Have to say one has to put everything to create a course like this !!!
    Thanks for the awesome and intuitive course but kunal bhai please complete this playlist. We really need videos on the rest of the topics!!!!!!!

  • @learnandtravel7722
    @learnandtravel7722 Год назад +1

    so here i completed more than half of the videos of this dsa playlist, day by day dsa is looking easy thanks to kunal for this amazing playlist and waiting for you to complete this playlist

  • @abhinavrai5762
    @abhinavrai5762 Месяц назад +2

    Kunal Sir please complete this video playlist we really need you out here...

  • @KshitizAnand-xr1wj
    @KshitizAnand-xr1wj 2 месяца назад

    Thank you so much Kunal for teaching us the recursive way of bubble sort and selection sort, that was so amazing.

  • @ridoychandradey8337
    @ridoychandradey8337 2 года назад +3

    Recursion guru Kunal Kushwaha. Eagerly waiting for dynamic programming series.

  • @devjoshi7062
    @devjoshi7062 3 года назад +6

    really liked how you changed the intuition of pattern algorithm to make us understand the recursions for both the sorts, kinda makes people get up from all the boring tutorial vibe, haha loved it

  • @ishanvyas2178
    @ishanvyas2178 4 месяца назад

    your explaination is so clear i was able to solve the bubblesort and selection sort problem with recursion without looking your solution first. Thanks a lot brother you're really awesome

  • @sidhantgupta64
    @sidhantgupta64 Год назад

    I watch many videos for recursion but your one is the best because the way of teaching is good

  • @jamespeterson7824
    @jamespeterson7824 2 года назад +21

    Good thought process by making that pattern question relatable to BubbleSort and SelectionSort.. Good knowledge is being grasped from you day by day 🙂

    • @KunalKushwaha
      @KunalKushwaha  2 года назад +10

      You're most welcome

    • @santhosh7042
      @santhosh7042 2 года назад

      Can you helpme out
      find what's wrong with this selection code after debugging i get to know that the zero index value is swapping with it's next value when the before pass is sorted let me explained what i saw on debugging is
      arr= 4 , 3 , 2 ,1 where s = 0; e = arr.length-1
      when s = 0 (index) e = 2(index)
      arr is sorted i got the desired answer
      but when s = 0 and e = 1
      it again get maximum value as 1 and rather than swapping with it self it is swapping with next index value and
      resulting in 2 , 1 , 3 , 4
      static void selection_sort(int[] arr)
      {
      helper(arr,0,arr.length-1,Integer.MIN_VALUE,-1);
      }
      static void helper(int[] arr, int s, int e,int max,int max_index)
      {
      if(e==0)
      {
      return;
      }
      if(s

    • @aeroabrar_31
      @aeroabrar_31 2 года назад +4

      @@KunalKushwaha Please continue this Bootcamp !!😪😭

    • @akashstark1836
      @akashstark1836 Год назад

      ​@@santhosh7042in if condition you have to give like s

  • @MegaArvind111
    @MegaArvind111 3 года назад +2

    Time for a job change...
    This is best playlists to work thru...

  • @abirgupta2711
    @abirgupta2711 3 года назад +17

    Hey Kunal, can you share a tentative timeline for this bootcamp? That will be very helpful. Anyways the videos are super awesome !!

  • @vedanta007
    @vedanta007 3 года назад +6

    Kunal bro on fire 2 videos within 24hrs 🔥🔥

  • @AdityaSingh-nz2if
    @AdityaSingh-nz2if 5 месяцев назад +1

    MindBlowing , u just connected a simple pattern question to BubbleSort , gave JEE feel when my teachers used to connect Advance problems to a simple concept. I am eagerly waiting for the DP series.

  • @Hello_Beasty
    @Hello_Beasty 3 года назад +15

    Bro make a video on how a new coder start it's journey and when we do internship

  • @fitnessandscience1575
    @fitnessandscience1575 3 года назад +2

    Thanks for sharing ur beautiful knowledge kunal bro ❤️❤️❤️

  • @parul8334
    @parul8334 Год назад +3

    Today I have done all easy question from the assignment and tomorrow I will try the medium one

  • @aman_mandal
    @aman_mandal 3 года назад +8

    Although...am lil far from this lecture...but thankyouu for the consistency sir❤️✨

  • @burhanuddinraja7209
    @burhanuddinraja7209 2 года назад +6

    Kunal a humble request to please start the topics like Dynamic programming, hashing and stuff. It will be very helpful. Your explanations are good that's why.

  • @Helly_Patel
    @Helly_Patel 2 года назад +4

    Thanks for teaching us like no one did till now!! One small request, please make lectures on dynamic programming as well!!

  • @shadowmonarch1432
    @shadowmonarch1432 Год назад

    After getting a feel of recursions,I'm able to solve all of them before the video🥲 thanks Kunal🙂

  • @Furious_footballs
    @Furious_footballs 2 месяца назад +1

    short code for triangle 1
    static void pattern(int row , int col)
    {
    if(row==col)
    {
    System.out.println();
    pattern(row-1,0);
    }
    if(row>col)
    {
    System.out.print("* ");
    pattern(row,col+1);
    }

  • @KhushiSingh-ft8dk
    @KhushiSingh-ft8dk 5 месяцев назад

    This playlist helps me a lot, thanks sir for providing such an amazing course..😇

  • @KovidhVSBhati
    @KovidhVSBhati 6 месяцев назад

    i think for first if(c < r) it should be if(c

    • @450Santoshmaharana
      @450Santoshmaharana 3 месяца назад

      @KovidhVSBhati
      I believe, in last else condition (when c==r), swap when last element in array is less then max

    • @ShaikAtif-kg5qm
      @ShaikAtif-kg5qm Месяц назад

      bro, column value starts from 0, so let say for example r=4, then c will be from 0 to 3. from 0 to 3 four checks are done so no need of c

  • @malishagavali9225
    @malishagavali9225 4 месяца назад +1

    Oh gosh, I was banging my head against the wall! I really thought we were going to print the pattern using bubble sort. Now I understand that we're solving bubble sort using recursion, haha

  • @akshaygill4483
    @akshaygill4483 Год назад

    Man you taught me how to debug a code , and it is very usefull while doing recursion questions thanku so much

  • @pawanyadav4024
    @pawanyadav4024 2 дня назад

    thank you so much for simplifying the selection sort

  • @rajeevkandpal1880
    @rajeevkandpal1880 Год назад +5

    Hey @Kunal, thanks for all the awesome content you are providing for free. This is pure GOLD i must say. Can you point me to some of DP videos you have, I am not able to find anything on DP on your channel?

  • @nikitajaiswal9112
    @nikitajaiswal9112 2 года назад +2

    Q. 1 solution
    Def triangle(n) :
    If n==0:
    return
    Print("* "*n)
    triangle (n-1)

  • @KrishNamaste
    @KrishNamaste Год назад +2

    Man, please continue this if it is possible.

  • @devendrasolunke4619
    @devendrasolunke4619 2 года назад +6

    Bro you bring back my confidence and intrest in programming..❤️

  • @foyzanahmed4091
    @foyzanahmed4091 Год назад +1

    brother, Please start DP series. You are magician.

  • @hello_kitty1234-r9l
    @hello_kitty1234-r9l 2 месяца назад

    kunal be like : no i m not gonna explain it again and after 5 mins he is literally explaining same thing just to make us understand , hats off to him man

  • @keshav-ip7vx
    @keshav-ip7vx 2 года назад +1

    in the first program, the stack size is the total number of (*) or O(row^2) so we should return until we start printing the next row for good programming practice.

  • @dankcricket5730
    @dankcricket5730 3 года назад +28

    Kunal bro, is it possible to complete this Bootcamp by November 2nd week?
    Hope you complete this Bootcamp by mid November!🙏

    • @yogeshyts
      @yogeshyts 2 года назад +3

      next year k november a gya abhi tk ni hua🤣🤣🤣🤣🤣🤣

    • @aeroabrar_31
      @aeroabrar_31 2 года назад

      @@yogeshyts han LOL🤣

    • @yogeshyts
      @yogeshyts 2 года назад +1

      @@aeroabrar_31 February m start hoga ab bola h usne

    • @aeroabrar_31
      @aeroabrar_31 2 года назад

      @@yogeshyts Kidhar bola hai bhai usne..
      Mai toh puri tarah usi par depend hua hoon 🥺

    • @yogeshyts
      @yogeshyts 2 года назад

      @@aeroabrar_31 twitter p active h wo

  • @yogeshkumarpandey2343
    @yogeshkumarpandey2343 2 года назад

    *This is my C++ Code. The course is Fantastic.*
    void buble(int *arr,int n,int end,int itr)
    {
    if(end==0)
    {
    return;
    }
    if(arr[itr]>arr[itr+1]&&itr

  • @shraddhaverma6434
    @shraddhaverma6434 3 года назад +2

    Thanks for the amazing content kunal 🔥 kudos!

  • @mathis-meth4229
    @mathis-meth4229 Год назад

    Kunal is the OG of DSA teaching

  • @pikayaan
    @pikayaan 14 дней назад

    the 1st triangle can be solved using only one variable with the help of a helper function:--
    static void pureRecur(int i) {
    if (i == 0)
    return;
    printrow(i);
    pureRecur(--i);
    }
    static void printrow(int n) {
    if (n == 0) {
    System.out.println();
    return;
    }
    System.out.print("*");
    printrow(--n);
    }
    public static void main(String[] args) {
    pureRecur(10);
    }

  • @akashstark1836
    @akashstark1836 Год назад

    For selection sort we can start column value from 1 since we assign max as 0 in initial all the time , we don't have to check 0 th position with 0th

  • @Aspirantonmission25
    @Aspirantonmission25 2 месяца назад

    Sir,you made my life so easy ❤❤❤

  • @nayanmu
    @nayanmu 2 года назад +12

    Awesome bro..when will you teach us dynamic programming?

  • @kvcricketech
    @kvcricketech 3 месяца назад +2

    Dynamic programming playlist please

  • @reshihashim4094
    @reshihashim4094 3 года назад +9

    u make things easier and simpler to understand .... thank u so much for this Recursion playlist 🔥🔥🔥...
    Learnt a lot from you, like how to approach a problem and different ways of solving a particular problem and so on...
    keep it up brother 🙂🙂🙂
    Love from Kashmir ❤️

  • @kishanmadlani1391
    @kishanmadlani1391 Год назад

    10:00
    this is also a one method for print the stars method
    static void triangle(int r ,int c){
    if (c 0) {
    System.out.print("* ");
    printStars(n - 1);
    }
    }

  • @dipalitusharvlogs7252
    @dipalitusharvlogs7252 Год назад

    As always, simplified and awesome explanation💚

  • @kartik7239
    @kartik7239 7 месяцев назад

    I was hoping you finish this playlist.

  • @atulpanda6051
    @atulpanda6051 3 года назад +2

    Thanks for this Recursion video

  • @Luffy_2804
    @Luffy_2804 Год назад

    after hint :
    static void printPattern(int row , int col , int n){
    if(row==0) return;
    if(col

  • @Adonis08
    @Adonis08 Год назад +1

    Selection Sort Without Max Variable!!
    static void selection(int[] arr, int r, int c)
    {
    if(r==0) return;
    if(r>c)
    {
    if(arr[c]>arr[r])
    {
    int t=arr[c];
    arr[c]=arr[r];
    arr[r]=t;
    }
    selection(arr,r,c+1);
    }
    else{
    selection(arr,r-1,0);
    }
    }

  • @litheshshetty7839
    @litheshshetty7839 2 года назад

    7:23 eagerly waiting for it bhai!!!

  • @arbindsharma1423
    @arbindsharma1423 Год назад

    bhai, I can't see dynamic problems video? Can you please upload one .. and bdw loved your content.

  • @anandrengu5806
    @anandrengu5806 8 месяцев назад

    Hi Kunal, Nice playlist ,it is helping me a lot ,I have a doubt like in triangle2 ,I think so you missed to mention that function call like (3,3) ,(2,2) ,(1,1) will also happen .Anyways thanks man for your amazing playlist.

  • @shubhanshukushwaha6150
    @shubhanshukushwaha6150 Год назад

    bubble sort gives stackoverflow at line no. 53 in your code , kindly take example as 4872.

  • @dinbandhusharma4568
    @dinbandhusharma4568 Год назад

    thanks for this amazing video 🤗👍🏻🔥❤‍🔥

  • @kanyapandey
    @kanyapandey Год назад

    Thank you my Guru 👏👏👏👏

  • @Naveen-jl1vz
    @Naveen-jl1vz Год назад

    ❤...bro linkedlist,graphs,dp videos?

  • @sudhanshukushwaha6351
    @sudhanshukushwaha6351 2 года назад +1

    In every classroom there are such students who ask like this 😁😁

  • @deepaksai3637
    @deepaksai3637 2 года назад

    Nice video,but pls complete the playlist

  • @akhilyadav7540
    @akhilyadav7540 2 года назад +2

    Kunal please make a video on dynamic programming and grap also 🙏🙏❤

  • @srinivasanshankaranarayana3093
    @srinivasanshankaranarayana3093 3 года назад +4

    Awesome content 👏👌

  • @priyanshuvettori5179
    @priyanshuvettori5179 Год назад

    wow this is wonderful really.

  • @vaishnaviummaji321
    @vaishnaviummaji321 Год назад

    @KunalKushwaha when will you start dynamic programming series?

  • @ihsannuruliman3656
    @ihsannuruliman3656 2 года назад +1

    Great coding, probably a little bit improvement to the recursive bubble sort algorithm. We don't need to check further if no swap happened in a row. Here, i is column and end is row.
    static boolean swapped = false;
    public static void sort(int[] arr, int i, int end) {
    if(end < 1) return;
    if(i < end) {
    if(arr[i] > arr[i+1]) {
    // swapping
    int temp = arr[i+1];
    arr[i+1] = arr[i];
    arr[i] = temp;
    swapped = true;
    }
    sort(arr, ++i, end);
    } else {
    if(!swapped) return;
    swapped = false;
    sort(arr, 0, --end);
    }
    }

  • @Aakashhoney278
    @Aakashhoney278 Год назад +1

    please complete the course sir

  • @rahuldev6206
    @rahuldev6206 2 года назад +1

    nice content we love your efforts can you suggest me any course of android development❤❤

  • @akshayjha8369
    @akshayjha8369 9 месяцев назад +1

    pls upload dp and graph videos asap

  • @mohakhiphop
    @mohakhiphop 2 года назад

    At this stage I'm able to solve given problems before i see your solution 🙌 hats off and huge thanks to you for helping me in developing the approach ❤️💯

  • @cindrasenareddy1929
    @cindrasenareddy1929 2 года назад +1

    asusual kunal rocks!!!!!!!!!!

    • @amaanullah13
      @amaanullah13 2 года назад +1

      Bro put space after "as"
      I've read it asexual Kunal rocks🤣

  • @kritikjain3617
    @kritikjain3617 2 года назад +1

    What an explanation man!

  • @mudittiwari8615
    @mudittiwari8615 Год назад

    I love this course

  • @itshari5489
    @itshari5489 Год назад

    Video 29 Completed!

  • @anchit1237
    @anchit1237 3 года назад +11

    Kunal, Can I learn C++ and Java together?
    I know it's difficult but would there be a bigger problem in the future?

    • @prakhar266
      @prakhar266 3 года назад +10

      Learn either java or c++ thoroughly first .other language will take max 15 days for completion

    • @rashidansari4176
      @rashidansari4176 3 года назад +1

      @@prakhar266 Completely agree with with you bro, learn anyone first. then switching is to another is quite easy.

    • @mohammedsuhail8706
      @mohammedsuhail8706 3 года назад +6

      Syntax will screw u
      If u try to learn it together

    • @amansayer4943
      @amansayer4943 Год назад

      @@mohammedsuhail8706 bhai wahi hogaya mere sath .

  • @shetty-m4d
    @shetty-m4d 9 месяцев назад +1

    6:50 bro when u gonna do dynamic programming

  • @feliksbekeshov7668
    @feliksbekeshov7668 Год назад

    Kunal when we will have Trees and Graphs here in this DSA playlist??????

  • @garvitmathodia8268
    @garvitmathodia8268 Год назад

    bro please make a series on DP

  • @spdwivedi5925
    @spdwivedi5925 4 месяца назад

    Great video

  • @amandixit8342
    @amandixit8342 3 года назад

    Wow , recursion ki ek aur video 😁😁

  • @amandixit8342
    @amandixit8342 3 года назад

    Bhaiya (arrays ,pattern , strings..etc )on recursion topic ki easy ,medi ,hard arrange kar dijiye bhaiya please , aur Assignment mein aur ques practice ke hote toh acha rehta

  • @itshari5489
    @itshari5489 Год назад

    32:05 We are considering index value not the exact value.
    arr[max] = 4 & arr[c] = 4
    By mistake kunal says 4 greater than max value.
    Instead its equal so no updation in max index postion.

  • @varunsen2802
    @varunsen2802 3 года назад

    Thank You so much brother!

  • @ABHISHEKKUMAR-do7uw
    @ABHISHEKKUMAR-do7uw Год назад +1

    Hello Sir bubble sort code is giving stackOver flow error when size of the array is increased .
    Here is the constrain for the length of an array
    1

  • @surajitmandal1163
    @surajitmandal1163 21 день назад

    Kunal sir waiting for dynamic programming series 😢😮

  • @Aniket_0314
    @Aniket_0314 Год назад

    woooooo hoooooooooooooooooooo great video ✨😊

  • @SiddhiGupta-o5m
    @SiddhiGupta-o5m Год назад

    when will you upload dp stuff????

  • @veerendrasaikumar1008
    @veerendrasaikumar1008 Год назад

    Kunal, The TC for best case scenario in Bubble sort is 0(n), however using the recursion example it is still o(n2). Is there a way to include an extra flag as parameter and break recusion if the array is already sorted like we did in iteration example.

  • @akashvadher6724
    @akashvadher6724 3 года назад

    Make video on quick sort and mergesort using recursion

  • @malishagavali9225
    @malishagavali9225 4 месяца назад

    Here is my solution to selection sort before explaination
    static void selection(int [] arr, int length){
    int index = 0;
    int max = 0;
    if(length==0){
    return;
    }
    while(index= arr[max]) {
    max = index;
    }
    index=index+1;
    }
    //swap
    int temp;
    temp = arr[length - 1];
    arr[length - 1] = arr[max];
    arr[max] = temp;
    selection( arr, length-1);
    }

  • @rudram4534
    @rudram4534 2 года назад

    still watching consistently
    😀😀😀