Website marketing using high authority backlinks from popular website's, find out more at webcentreplus.com or email colin@webcentreplus.com

## Coding Challenge #114: Bubble Sort Visualization

In this coding challenge, I visualize a “bubble sort” algorithm in Processing (Java). #SortingTrain

(Correction: At 3:53 I incorrectly state that N’s growth is exponential, I should have said “quadratic” or “polynomial”.)

π http://thecodingtrain.com/CodingChallenges/114-bubble-sort.html

π Visualizing Algorithms: https://bost.ocks.org/mike/algorithms/

π Website: http://thecodingtrain.com/

π Patreon: https://patreon.com/codingtrain

π Store: https://www.designbyhumans.com/shop/codingtrain/

π Books: https://www.amazon.com/shop/thecodingtrain

π₯ Beginners: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA

π₯ Coding Challenges: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH

π https://p5js.org/

π https://processing.org

source – For all your website needs, visit Spalding Web Design

#### 45 Responses to *Coding Challenge #114: Bubble Sort Visualization*

### Leave a Reply

You must be logged in to post a comment.

were does he stream?

Gravity sort plz do gravity sort

Can you do a brute-force algorithm? I had an assignment to do a I/O brute-force algorithm in C# for an input with a maximum length of 12 characters. I could do it, but the app freezed until it was done. I tried async, but that only worked for the first few seconds, then it froze again xD

i barely understand whats going on but it seems cool

the best sort: it just deletes all of the items

You can use bully sort:

Choose the first element.

Delete the rest of the elements.

Your array is now sorted.

Congratulations, you made me want to learn how to code.

Actually it grows polynomially and not exponentially since O(n^2) < O(2^n). For instance, in the case of n=6 as in your example, a polynomial growth implies 36 computations, while an exponential growth 64. Just as a reminder (from biggest to smallest)

– Factorial O(n!)

– Exponential O(a^n) for a fixed

– Polynomial O(n^a) for a fixed

– O(n log n)

– Linear O(n)

– Logarithmic O(log n)

– Constant O(a) for a fixed

Great video as always! <3

New sorting algorithm >> DERP SORT

Sets a random number to the begining and if it is the smallest keep it and remove it from the list, else get a new random number from the list and keep the old one in the list.

Mindblown

Hi Dan!

I assume a component of the relatively poor performance is your swap function – I believe you should have inlined the swap logic rather than returned a whole new array in the swap function

I implemented a few using react check it out here: https://github.com/Shazambom/sorting just run npm install then npm run

3:22 look at Bogo sort

π i don't know coding but i enjoy your videos and explanation..

I made a Python version!

https://github.com/Aryamaan08/bubble-sort-processing.py

Check the Issues section for bug (I hate the bug)

As I goes up…

My grammar instincts kick in

El julioprofe de la programacion

Can anyone tell me plzz .what we can do with this bubble sort??π

How did I miss this one? Thanks for the video Dan

this man be cool

How much programming language's do you know ?

Please respond by another video

released on my birthday!

ta DAAAAAA bay bay

I suggest Radix LSD Sort

Are the black hanging lines being sorted or the white standing lines? π€

I spent like 3 hrs in js trying to do the same thing even before I saw this video

Visualize binary radix sort

Hey can you make a video on Insertion sort please!!!

Hi buddy , can you make a heart popping a name out of it ?

could you post a video talking about Stack, queue, and general algorithms and data structure please? you are the best π

Can You do this but with Text?

You missed the oppurtunity to bubble sort visualize with bubbles (ellipse)..

The buble sort is one of the easiest to code. I already coded it once :).

is it just me or is the grey in your hair different every time

I need a drug this dude uses it.

Yeah that's really cool and stuff. But are you Subscribed to PewDiePie?

9:00 an insult for C pointers

Which IDE is it??

Again the video i wanted to see….. thank you very much for this video…

No XOR swapping, ok…. I am just going to cry in the corner now.

Bubble sort is bad, sure, but slow sort is…slow sort is something else.

do the bogo sort

The most (and kind of least) efficient sorting algorithim is the random sort; you randomly arrange the numbers, and check if it's correct.

What was the βon holdβ music you briefly played? That was awesome π€

sort like that ! https://youtu.be/kPRA0W1kECg

video very noisy π