Bubble Sort Algorithm Tutorial in Java - How Fast Is It?

แชร์
ฝัง

ความคิดเห็น • 113

  • @miigon9117
    @miigon9117 3 ปีที่แล้ว +40

    I’ve been writing blogs to explain to my friends some programming topics myself so I totally understand the amount of work one have to put in to explain a topic so well and still keep it concise. Keep up the great job mate!

    • @CodingWithJohn
      @CodingWithJohn  3 ปีที่แล้ว +20

      Thanks, I appreciate the kind words! It certainly does take a while. By the time I'm done planning, writing, recording, editing, and uploading, it's sometimes surprising how long it takes to make a decent 10-minute video. But that's the idea, spend the time on my end to deliver a clear message so viewers don't have to!

  • @parker5791
    @parker5791 3 ปีที่แล้ว +10

    I love your video style! bite size videos that really tackle the nitty gritty of the topic, not just being vague / bridging gaps with your own knowledge. You make learning these topics a lot easer! thank u!

  • @micleh
    @micleh 2 ปีที่แล้ว +8

    Almost perfect. This is one of the many sorting algorithms that is mandatory in German higher education computer science classes. We also evaluate the complexity by measuring the time and we talk about the mathematical representation of the complexity.
    I said almost perfect because we try to optimize the algorithm, e.g. by reducing the length of the array that must be checked after each cycle. As you explained, the last and last but one element don't have to be checked. The question also arises whether using two for loops and a boolean is faster.

  • @TTaiiLs
    @TTaiiLs 3 ปีที่แล้ว +14

    I can't belive you don't have more subs, ur videos are great

    • @CodingWithJohn
      @CodingWithJohn  3 ปีที่แล้ว +4

      Thanks, of course I'm doing what I can to keep it growing! The liking/commenting/subscribing are very all much appreciated. Feel free to share with anyone you think may be interested as well. I try not to spam my own stuff everywhere 🙂

    • @theblindprogrammer
      @theblindprogrammer 3 ปีที่แล้ว

      This guy knows his stuff.

  • @FGj-xj7rd
    @FGj-xj7rd 2 ปีที่แล้ว +7

    I hadn't seen this approach to the Bubble Sort. We did it as a loop inside of another loop.
    This one seems cleaner.

    • @jasonkishore3400
      @jasonkishore3400 14 วันที่ผ่านมา

      this is a loop inside a loop

  • @barrabjj
    @barrabjj 6 วันที่ผ่านมา

    This is so much easier than the way I was taught. You have a way of explaining things that make concepts so clear. Even when I knew what you were going to explain next, I am impressed by the simplicity in which you break it down. Thank you for the video!

  • @ihsannuruliman3656
    @ihsannuruliman3656 2 ปีที่แล้ว +36

    Here's a little improvement to the Bubble Sort implementation:
    For every loop, there will be one highest element put to the rightmost of the array. So instead of hardcoding the numbers.length, put it in some variable before for-loop (ex: index = numbers.length). At the end of the for-loop block, decrease the index by one (index--). Because, you don't need in anyway checking the rightmost elements that have been checked in the previous loop. Those elements are already sorted.
    Here's the implementation:
    public static String bubbleSort(int[] numbers) {
    boolean swappedSomething = true;
    while(swappedSomething ) {
    swappedSomething = false;
    int index = numbers.length-1;
    for (int i = 0; i < index; i++) {
    if(numbers[i] > numbers[i+1]) {
    swappedSomething = true;
    int temp= numbers[i];
    numbers[i] = numbers[i+1];
    numbers[i+1] = temp;
    index--;
    }
    }
    }

    • @phutranminh2731
      @phutranminh2731 2 ปีที่แล้ว +4

      the line "int index = numbers.length-1;" need to be placed outside of the While block. If you placed it like this, everytime the first loop starts, it will set default index to a fixed length in which the second loop will always check the whole array.

    • @kafkahesse2606
      @kafkahesse2606 ปีที่แล้ว

      the idea of this video is not how to improve bubble sort. i have tons ideas, but it doesn't matter, and it is not needed.

    • @lupserg302
      @lupserg302 ปีที่แล้ว +4

      This *improvement is worse in therms of speed because with every swapp , the index will be lesser and lesser . Suppose your minimum number is the last one , so your method will ignore that number untill all numbers before are sorted (checked with debuger). So , the method will do even more iterations to replace that number because it every time will set index for n-1. To improve your ideea, i set index before While and index-- after looping , so when the iterations stops, the index will be the maximum number compare to the left side so it will be unnecessary to check the right side of index (this method will sort the maximum number in each iteration). I hardly recommend to use Debuger to check each iteration and each variable at each iteration.
      Anyway, thanks for your ideea!
      Here is my improvement :
      public static String bubbleSort(int[] numbers) {
      boolean swappedSomething = true;
      int index = numbers.length-1;
      while(swappedSomething ) {
      swappedSomething = false;
      for (int i = 0; i < index; i++) {
      if(numbers[i] > numbers[i+1]) {
      swappedSomething = true;
      int temp= numbers[i];
      numbers[i] = numbers[i+1];
      numbers[i+1] = temp;
      }
      }
      index--;
      }
      }

    • @jonathanclerence259
      @jonathanclerence259 ปีที่แล้ว

      @@kafkahesse2606 what are you man he is just trying to help if you don't want it just ignore it

    • @shankar7435
      @shankar7435 4 หลายเดือนก่อน

      @@lupserg302 index should be decremented only if the swapped flag is true.😊😊😊

  • @linushoja7397
    @linushoja7397 2 ปีที่แล้ว +2

    You could also just use another int to declare the last switched index, so you can just leave the rest, sorted array untouched, this should safe you a lot of time with big arrays, because it just gets at least one iteration smaller each round.

  • @prasadjadhav3906
    @prasadjadhav3906 2 ปีที่แล้ว

    This visual representation is the best thing ever

  • @BlekSteva666
    @BlekSteva666 ปีที่แล้ว

    we need to address the elephant in the room -> Kramer painting :) Your channel is pure gold, keep up the good work!

  • @programwithviggo2197
    @programwithviggo2197 ปีที่แล้ว

    That's the best implementation of bubble sort I have ever seen

  • @Breezy-swims
    @Breezy-swims 2 ปีที่แล้ว

    Honestly this made more sense than when my professor briefly explained how it worked then left it at that.

  • @iskrega
    @iskrega 2 ปีที่แล้ว

    going to pass my Algos class because of this channel! Love your channel my friend.

  • @moinvohra5505
    @moinvohra5505 2 ปีที่แล้ว +2

    Love watching your videos to learn Java. Keep it up John. Best tutorial on TH-cam. And hey can you tell us how to develop logic i mean after i see a video then only i understand the logic and i can code before that i don't have an idea.

  • @chixenlegjo
    @chixenlegjo 3 ปีที่แล้ว +12

    Bubble soft is usually better than bogo short, but not always.

    • @Tidbit0123
      @Tidbit0123 2 ปีที่แล้ว +1

      bogo sort sounds like it has the potential to swap in one interation lol (probably never going to happen)

    • @realdotty5356
      @realdotty5356 2 ปีที่แล้ว +5

      Bogo sort could theoretically outperform any sorting algorithm in the world

    • @pogchamppizzaslord8806
      @pogchamppizzaslord8806 2 ปีที่แล้ว +1

      It is also likely to realistically never sort :,(

  • @pradeexsu
    @pradeexsu 8 หลายเดือนก่อน +1

    in inner for loop we can put an `i< numbers.length -1 - iteration_count`.
    there is no need to compare already bubbled element in previous iteration, that are already in right place.
    ```
    private static void bubbleSort(int[] numbers) {
    boolean swappedSomething = true;
    int iter_count = 0;
    while (swappedSomething) {
    swappedSomething = false;
    for (int i = 0; i < numbers.length - 1 - iter_count; i++) {
    if (numbers[i] > numbers[i + 1]) {
    swappedSomething = true;
    int temp = numbers[i];
    numbers[i] = numbers[i + 1];
    numbers[i + 1] = temp;
    }
    }
    iter_count++;
    }
    }
    ```

    • @techeadache
      @techeadache 7 หลายเดือนก่อน

      Good work. There is a subsumed version that can be found in Wikipedia. The comparison count is reduced by 50%. It has no boolean variable. Instead it keeps track of the last item swapped and enforces a new upper limit.

  • @richardmeyer418
    @richardmeyer418 2 ปีที่แล้ว +1

    Just something to think about. Since every time you go through the for statement, the last number is in the correct place, you only have to go through it to "length -1" once and the next time is "length - 2" and you'd be doing one less comparison and loop each time, so wouldn't the complexity be less?
    If you still have the source code, would you make the change and let me know if it makes a difference? Obviously with the way you have it set up, you'd have to generate a "permanent" array and copy it to sort it both ways.
    Just a thought - and it's easy for me to hand out assignments to someone who's just trying to advance knowledge on the internet.
    Thanks for the tutorial.

  • @abdfrehat2640
    @abdfrehat2640 ปีที่แล้ว +1

    I think you should not print the elements of the array if you want to check the running time for the algorithm
    most of the time is in writhing the elements to the screen

  • @CanHaktan
    @CanHaktan ปีที่แล้ว

    Clearly amazing, wow, while loop was clearly making sense! Thank you for explaining this sorting algorithm

  • @zainabalayande278
    @zainabalayande278 ปีที่แล้ว

    Fantastic! Fantastic!! Fantastic video John!!!

  • @michael_scarn_
    @michael_scarn_ 10 หลายเดือนก่อน

    Thank you John! Your work is much appreciated, you're an excellent teacher. Hats off!

  • @destroyer6679
    @destroyer6679 2 ปีที่แล้ว

    Very nice. One of the best java teacher on the TH-cam. Nice explanation. Thanks ❤

  • @javlontursunov6527
    @javlontursunov6527 2 ปีที่แล้ว

    Man definitely something I have been looking for

  • @theblindprogrammer
    @theblindprogrammer 3 ปีที่แล้ว +3

    Thank you for sharing with us this tutorial. Really helpful.

  • @ivanovmario_5398
    @ivanovmario_5398 3 ปีที่แล้ว +6

    Can you do a video about MergeSort?? thank you

    • @CodingWithJohn
      @CodingWithJohn  3 ปีที่แล้ว +3

      I'll see what I can do!

    • @CodingWithJohn
      @CodingWithJohn  3 ปีที่แล้ว +1

      FYI, I'm in the process of making the merge sort video right now! It's much more complicated for a beginner than bogosort or bubble sort, and tougher to explain clearly so it's taking a while, but I hope I do it justice. Should be uploaded in the next day or two.
      I would make a community post about this instead of replying to a comment, but apparently TH-cam doesn't allow community posts with less than 1,000 subs. Lame.

    • @CodingWithJohn
      @CodingWithJohn  3 ปีที่แล้ว +1

      Here you go! th-cam.com/video/bOk35XmHPKs/w-d-xo.html

    • @ivanovmario_5398
      @ivanovmario_5398 3 ปีที่แล้ว

      @@CodingWithJohn Thank you!!!

  • @alexevd715
    @alexevd715 11 หลายเดือนก่อน

    this is the best solution to understand, thank you very much!

  • @FrankJohnson44321
    @FrankJohnson44321 9 หลายเดือนก่อน

    Great example.
    I don't know if the following "improvements" help much. On my ancient Dell-M4800 using Amazon Corretto 17 JDK I'm getting a touch under 30 seconds for 100,000 records.
    The fewer additions we can do, I assume the better, but at the expense of more memory. Also note we can reduce N by one every time through the loop since after every time, the greatest number is at the bottom, then bottom-1, then bottom-2, etc. Maybe after a few thousand iterations, we're just "spinning our wheels" at the last few thousand iterations as they've already been sorted.
    Likewise every array "lookup" I like to do once, assign it to a variable (numsI, and numsIP1 --> versus repeating nums[i] and nums[i + 1]).
    Once again I can't say how much time all these "improvements" buy us.
    int n = nums.length - 1;
    while (swap) {
    swap = false;

    for (int i = 0; i < n; i++) {
    int ip1 = i+1;
    int numsI = nums[i];
    int numsIP1 = nums[ip1];
    if (numsI > numsIP1) {
    int hold = numsI;
    nums[i] = numsIP1;
    nums[ip1] = hold;
    swap = true;
    }
    }
    n -= 1;
    }
    }

  • @orusuvenkatesh6621
    @orusuvenkatesh6621 2 ปีที่แล้ว

    Very clear explanation i even enjoyed learning by watching it..

  • @josephpettit1519
    @josephpettit1519 3 ปีที่แล้ว +1

    I noticed that you used length - 1 as the index for the second to last element of the array. But array[length] should be out of bounds. Only 0 to length -1 are valid. I'm guessing that java doesn't throw an out of bounds error since the sort worked regardless. But I think the slightly more efficient method would be length - 2. Also, first pass through forces the highest number to the end, so there's no need to check the last number in the second pass. So, the range could be decremented by 1 with each iteration through the bubblesort. While still O(n^2) the actual time is cut in half.

    • @josephpettit1519
      @josephpettit1519 3 ปีที่แล้ว +1

      Oh wait. I just rewatched. The for loop was using the less than symbol, not

    • @CodingWithJohn
      @CodingWithJohn  3 ปีที่แล้ว

      No worries! Yeah Java would have thrown an IndexOutOfBoundsException if the actual length was used as the array index.
      You're absolutely right - because you know the largest value bubbles to the end each time, you can absolutely decrement the range each iteration like you're saying to cut back on all those extra unnecessary comparisons.

  • @billie7745
    @billie7745 2 หลายเดือนก่อน

    I'm confused, 8:13 doesn't look sorted? Shouldn't it be 0128 or am I missing something here?

  • @aobcd.8663
    @aobcd.8663 2 ปีที่แล้ว +1

    In java it takes time to even print on stdout...program will run faster without print

  • @wafflewafflewaffle
    @wafflewafflewaffle 2 ปีที่แล้ว

    can also use while (!swappedSomething) { ...} like that you can set the boolean to false to start

  • @ChristopherCLibre
    @ChristopherCLibre ปีที่แล้ว

    omg, you explained this very good. I subscribed to you now

  • @nguyentranbao839
    @nguyentranbao839 2 ปีที่แล้ว

    Very carefully explained. Thank you very much for the video

  • @francksgenlecroyant
    @francksgenlecroyant 2 ปีที่แล้ว

    Ooh i was doing it the wrong way, but happily i can do it nicely thanks to you John, the way you did it, is pretty clean and understandable. I was doing it with the explicit 2 loops, the old way haha, still cannot improve the performance but at least the code is easy to understand

  • @lucasqwert1
    @lucasqwert1 ปีที่แล้ว +1

    private static void printArray(int[] numbers){
    for (int i = 0; i < numbers.length; i++) {
    System.out.println(numbers[i]);
    }
    } How to print the elements of the array in the same line with a semicolon seperator?
    Thank you :)

  • @troeteimarsch
    @troeteimarsch 3 ปีที่แล้ว

    Or instead of creating another loop to go through the array over and over again, one can simply reset i to - 1 in the if statement. Great video!

    • @Tidbit0123
      @Tidbit0123 2 ปีที่แล้ว

      Could you please provide some pseudo-code demonstrating this?

    • @troeteimarsch
      @troeteimarsch 2 ปีที่แล้ว

      ​@@Tidbit0123 sure. the goal is to get rid of the while loop at 7:36
      //Initial array
      int[] numbers = {5,3,4,7,2};

      //Iterator
      for (int i = 0; i < numbers.length - 1; i++) {

      //Sorting algorithm
      if (numbers[i] > numbers[i + 1]) {
      int temp = numbers[i];
      numbers[i] = numbers[i + 1];
      numbers[i +1] = temp;

      //The magic reset
      i = -1;
      }
      }
      //Output using Arrays wrapper class
      System.out.println(Arrays.toString(numbers));

    • @Tidbit0123
      @Tidbit0123 2 ปีที่แล้ว

      @@troeteimarsch that is very interesting! I just did a small set of testing and it seems for an array of size 100, the while - for approach runs at 400000~ nanoseconds (0.0004 seconds) while the single loop seems to run in 2000000~ nanoseconds (0.002) seconds.
      Any idea why that might be? My algorithm analysis skills are not so hot at the moment hahah still learning

    • @troeteimarsch
      @troeteimarsch 2 ปีที่แล้ว

      ​@@Tidbit0123 I can only guess. Even when the array is completely sorted the iterator will still go over it one more time instead of breaking out the while loop. Furthermore I guess it has something to do with branch prediction and other optimizations.
      You're into that - that's great! Keep it up, you're asking the right questions.
      Do your results change when the iterator variable counts down instead of up?
      Like this:
      for (int i = numbers.length - 1; i > 0 ; i--) {
      //Sorting algorithm
      if (numbers[i] < numbers[i - 1]) {
      int temp = numbers[i];
      numbers[i] = numbers[i - 1];
      numbers[i - 1] = temp;
      //The magic reset
      i = numbers.length - 1;
      }
      }

    • @Tidbit0123
      @Tidbit0123 2 ปีที่แล้ว

      @@troeteimarsch So I changed up my testing quite a bit, I created a count variable and added 1 to count on each iteration for every loop.
      The while/for and for/for approaches both take in 10-15,000 iterations to complete the operation.
      The single loop method is taking 100,000-130,000 depending on the array generated, while I know an array of 100 fixed numbers would give better results it feels pretty clear even with a random list.
      So when we reset the value of i each loop, it means we just compare a shorter set of numbers per loop, so it makes sense that the count variable is high, but I don't really understand the massive gap in performance being that it is 4x slower.
      Is it because we have to compare the same numbers again as we progress along the array? Because it's possible we have one element stop before making it to its correct position in the array, so basically just multiple interation phases for singular elements. Correct my if I am wrong with my understanding of how this operation works.

  • @winstonsmith1112
    @winstonsmith1112 2 ปีที่แล้ว

    very vivid, thank you ,John

  • @al-raffysarip6730
    @al-raffysarip6730 2 ปีที่แล้ว

    Do you have playlist for sorting algorithms?

  • @ataiabdiev2355
    @ataiabdiev2355 2 ปีที่แล้ว +1

    I've question about this algorithm. When we do first loop the max element will be at the end of array. Can we decrement loop by 1 on every while loop. Shortly, I want to say that we can neglect the last element and in every while loop we can write loop like :
    int length = list.length;
    while (sorted!= true)
    for(int i = 0;i < length-1;i++){
    do something();
    length -= 1;
    }
    please correct me if i've mistaken

    • @ankitatakale6913
      @ankitatakale6913 2 หลายเดือนก่อน

      Yes, I think you are right . we can use nested for loop here, and you will get 'an outer for loop index' to deduct it from " inner loop index "

  • @robertod893
    @robertod893 ปีที่แล้ว

    Great explanation, great video!

  • @danr943
    @danr943 2 ปีที่แล้ว

    Is that Kramer's photo on the bottom right ?

  • @OkuhleZA325
    @OkuhleZA325 19 วันที่ผ่านมา

    I'm the biggest fan of your videos

  • @bwprogrammers874
    @bwprogrammers874 3 ปีที่แล้ว

    You jst got urself a new sub, thanks a lot for nice content.

  • @SasuKev099009
    @SasuKev099009 2 ปีที่แล้ว

    Does anyone know how bubble sort would work for a string data type??

  • @Zero-ul6vx
    @Zero-ul6vx 2 ปีที่แล้ว

    Bro we need a lesson on selection sort,
    And another on comparision between selection and insertion sort,
    And lastly overall comparison between all other sorting algorithm (insertion, selection, bubble, quick, merge, heap) in terms of time, space complexity and when to use

  • @karlschnurr7016
    @karlschnurr7016 ปีที่แล้ว

    Thanks, you’re great!

  • @alojous
    @alojous 3 ปีที่แล้ว

    Could you explain why there are no pointers in Java? I’m learning java and c++ and the different types of variables in c++ confused me for a while.

  • @marcelobaldado514
    @marcelobaldado514 2 ปีที่แล้ว

    Hi genuine question
    when you set the swappedSomething = false;
    would that mean it will break through the while loop and never go to the for loop, Im fairly new to programming so im a lil bit confuse abt it

    • @Tidbit0123
      @Tidbit0123 2 ปีที่แล้ว +1

      So when we set swappedSomething = false, the while condition has already been evaluated to true in order to run, so it will continue until the end of the while loops code block before evauluating the condition again. If something was swapped in the for loop, the condition of swappedSomething = true again, and the while loop will repeat. If nothing was swapped, the value of swappedSomething will remain as false so the while loop will evaluate the condition as false, and thats when the looping will end.
      The behaviour you're referring to would be a break; or return ;statement, which would break the while loop no matter the conition

  • @asankasiriwardena3383
    @asankasiriwardena3383 2 ปีที่แล้ว

    a beautiful piece of code ! 😍

  • @moaly4738
    @moaly4738 3 ปีที่แล้ว

    Very instructive video thx a lot!!!

  • @u2bMusicBeauty
    @u2bMusicBeauty 2 ปีที่แล้ว

    Pretty cool,
    I like it!
    👍

  • @mdanisansari6657
    @mdanisansari6657 2 ปีที่แล้ว

    Great explanation...

  • @prasanthivasu
    @prasanthivasu ปีที่แล้ว

    Pls tell me a good book for java for beginners

  • @javlontursunov6527
    @javlontursunov6527 2 ปีที่แล้ว

    I think bubble sort is efficient in terms of memory since it does require extra memory

  • @eugenezuev7349
    @eugenezuev7349 5 หลายเดือนก่อน

    it was interesting, thanks

  • @NadChel1
    @NadChel1 ปีที่แล้ว

    I don't know how it happened, but I sorted a million-element int array with bubble sort in under 200 ms. It seems it's not that slow after all 🤔

  • @yqiwndbduebkdne
    @yqiwndbduebkdne ปีที่แล้ว

    what about from highest to lowest? badly need :(

  • @hashantha_lk
    @hashantha_lk ปีที่แล้ว

    John the man !

  • @chethans7436
    @chethans7436 2 ปีที่แล้ว

    Make a video to generate random numbers without using Randam class

  • @MTB_Bay_Area
    @MTB_Bay_Area 2 ปีที่แล้ว

    Thank you

  • @sohampinglikar1
    @sohampinglikar1 ปีที่แล้ว

    thank you.

  • @03MN03
    @03MN03 2 หลายเดือนก่อน

    THANK YOU SOOO MUCHHHHHHHHHH

  • @vnoommuy
    @vnoommuy 3 ปีที่แล้ว

    Aaaah the K man painting!

    • @CodingWithJohn
      @CodingWithJohn  3 ปีที่แล้ว

      I've been making videos for almost a year, and you're the first one to notice it!

  • @ahmadjammoul727
    @ahmadjammoul727 2 ปีที่แล้ว

    i love you man

  • @wristdisabledwriter2893
    @wristdisabledwriter2893 3 ปีที่แล้ว +1

    Can I ask for thread sort next

    • @CodingWithJohn
      @CodingWithJohn  3 ปีที่แล้ว +1

      I'm actually not familiar with thread sort, do you have a link? All I can find are multi-threaded versions of other sorting algorithms.

    • @wristdisabledwriter2893
      @wristdisabledwriter2893 3 ปีที่แล้ว

      @@CodingWithJohn actually it requires other algorithms

  • @navjotsingh2457
    @navjotsingh2457 2 ปีที่แล้ว

    ty

  • @joshuamodiba853
    @joshuamodiba853 2 ปีที่แล้ว +1

    At first I didn't want to care abt this BIG O of N² mentions
    But now... 😐 I'm thinking it's kind of important
    I can do it 🙂Copium

  • @billie7745
    @billie7745 2 หลายเดือนก่อน

    Gonna do this in python without knowing what this is

  • @usagi4342
    @usagi4342 ปีที่แล้ว

    may god bless you

  • @ThatGuy68580
    @ThatGuy68580 2 หลายเดือนก่อน

    I don't like how you keep mentioning bogo sort it kept confusing me

  • @lilthor7853
    @lilthor7853 2 ปีที่แล้ว

    If don't undertand something I don't give up, I just find another source of the same information. That's how I found your channel.
    From a non native speaker that's sick of indians
    Thank you!

  • @AdityaChaubey-i5e
    @AdityaChaubey-i5e 10 หลายเดือนก่อน

    Mujhe pta hi nhi tha johney sins programming bhi janta hoga 😮

  • @acolytes777
    @acolytes777 หลายเดือนก่อน

    Bubble-Sort = Bulbasaur.... sounds like it anyways.

  • @duvindudinethmin6820
    @duvindudinethmin6820 2 ปีที่แล้ว

    🖤

  • @DSEESanjayCK
    @DSEESanjayCK ปีที่แล้ว

    Your java course is forbidden please check

  • @GudeDoc
    @GudeDoc 3 หลายเดือนก่อน

    Nice video, but isn't this bubble sort?
    for (int i = 0; i

  • @roshansourav
    @roshansourav ปีที่แล้ว

    wooow

  • @lapepitadeorooficial
    @lapepitadeorooficial 2 ปีที่แล้ว

    i believe bubblesort is either bad explained or bad animated, actually compares first element to all, then second element to all from second element, then third element from all from third element and so on... not in pairs.

    • @lapepitadeorooficial
      @lapepitadeorooficial 2 ปีที่แล้ว +1

      oh i see gets implemented as the explanation and animation, i stand corrected

  • @germimonte
    @germimonte 2 ปีที่แล้ว

    is this a late april fools? you know that after each 'bubble' there will be one more ordered element? instead of a while just use 2 for loops, the first one moves the end point back and the second one moves the 'bubble'

  • @OkuhleZA325
    @OkuhleZA325 19 วันที่ผ่านมา

    I'm the biggest fan of your videos