Lines That Connect
Lines That Connect
  • 4
  • 1 924 393
The Bubble Sort Curve
A derivation of the curve that is approximated by a common visualization of the bubble sort diagram.
Read the full proof on my site: linesthatconnect.github.io/blog/a-rigorous-derivation-of-the-bubble-sort-curve/
The viral sorting algorithm video which first sparked my interest: czcams.com/video/kPRA0W1kECg/video.html
The animations in this video were created using Manim: www.manim.community/
Music credits:
Fluidscape by Kevin MacLeod is licensed under a Creative Commons Attribution 4.0 license. creativecommons.org/licenses/by/4.0/
Night Music by Kevin Macleod
river - Calm and Relaxing Piano Music by HarumachiMusic
... And a couple of my own songs:
The Fog: soundcloud.com/lines-that-connect/the-fog
Heavy Head, Light Rain: soundcloud.com/lines-that-connect/heavy-head-light-rain
Thanks For Watching: soundcloud.com/lines-that-connect/thanks-for-watching
Chapters:
00:00 Intro:
0:37 Laying the Background
3:20 How Bubble Sort Works
6:59 Mathematically Describing Diagrams
9:13 Stretching the Diagrams
11:52 Visual Derivation
14:38 Symbolic Derivation
16:48 Nice!
17:07 A Rigorous Solution
zhlédnutí: 357 317

Video

The Trig Hiding Inside the Factorials (And the Harmonic Numbers)
zhlédnutí 139KPřed rokem
In this video, we build on my last two videos by exploring connections between the gamma function (the extended factorials), the digamma function (the extended harmonic numbers), and trigonometry. We derive Euler's Sine Product Formula, which we then use to prove the gamma and digamma functions' reflection formulas. Finally, we derive a related formula for calculating cotangent. Watch my previo...
How to Take the Factorial of Any Number
zhlédnutí 1,1MPřed rokem
In this video, I walk through the derivation of an extension of the factorial function that works for any number: fractional, irrational, and even complex! This turns out to be a very important function, known as the gamma function, which has many surprising connections, one of which I explore in the last chapter of the video. The animations in this video were made with Manim, an open-source Py...
Extending the Harmonic Numbers to the Reals
zhlédnutí 302KPřed 2 lety
The harmonic numbers are the partial sums of the harmonic series - sums of whole number reciprocals. This video explores how we can extend their domain to the entire real line. The animations for this video were made with the community edition of Manim (www.manim.community). Huge thanks to everyone who worked on the library, as well as the members of the Discord server who answered my many ques...

Komentáře

  • @angusmaiden8871
    @angusmaiden8871 Před 18 hodinami

    @LinesThatConnect if you have come up with a derivation that actually contributes new knowledge, you should submit it to an academic journal rather then just post it in a blog.

  • @douggale5962
    @douggale5962 Před dnem

    That is the utterly naive version of the algorithm. I think you are missing the point of bubble sort. The idea is to drag the highest item to the end of the list. Once you finish a pass, the last item is the highest, so you can ignore it in the next pass. You ignore the last two the second pass, and the last three the third pass, and the last N the Nth pass. If you ever finish a pass without doing a swap, you are done right away. That is the only endearing property of bubble sort: it is the fastest when the list is already sorted, and is very fast if almost sorted. Okay it has two endearing properties: CPU caches love it.

  • @Bozebo
    @Bozebo Před dnem

    Okay so, this is one of the best things I've seen conveying how to apply mathematics functions to whatever problem (still reads easier to me in C++ but whatever xD).

  • @Williamtolduso
    @Williamtolduso Před dnem

    Nothing beats the Soviet sort

  • @Wishbone1977
    @Wishbone1977 Před dnem

    Fantastic video. You found the solution to a "problem" which is utterly useless and would seem to have no practical applications, purely for the joy of discovery and knowledge. And you explained it in a way that even non-mathematicians (i.e. me) can (mostly) understand. Well done, sir. I salute you 🙂

  • @corscheid
    @corscheid Před dnem

    This reminds me a lot of 3blue1brown style. Nice

  • @aniroblox7139
    @aniroblox7139 Před dnem

    Bubble sort lore??????

  • @lumina_
    @lumina_ Před 2 dny

    wow! beautiful

  • @Fongletto
    @Fongletto Před 2 dny

    You ever sometimes think that you're kind of smart, and then you come across videos like this and get depressed? Just me?

  • @rjstegbauer
    @rjstegbauer Před 3 dny

    Good video.

  • @GlutenEruption
    @GlutenEruption Před 3 dny

    I think it's pretty intuitively obvious that larger items out of place are going to be higher than the diagonal line, and since that algorithm is moving larger items to the right, it's going to form a curve.

  • @thealmightysnoood
    @thealmightysnoood Před 3 dny

    I think 3 brown 1 blue might sue.

  • @0xTJ
    @0xTJ Před 3 dny

    I'm happy that I ended up watching one of your other videos, and then subscribed. I had previously seen this video recommended to me over and over, but thought it was one of those viral sorting algorithm videos and didn't watch it. I'm happy that I was wrong, this video is very interesting and well done!

  • @lumina_
    @lumina_ Před 3 dny

    phenomenal!!

  • @CupidGTag
    @CupidGTag Před 3 dny

    bogo sort

  • @ricvanesh9445
    @ricvanesh9445 Před 3 dny

    Nice video , I was hooked (I was right it was one of those a/(b+x) shenanigans)

  • @kukuster
    @kukuster Před 3 dny

    nice...

  • @RickGGb1
    @RickGGb1 Před 3 dny

    So my question would be about the validity of the approximation: Given a big ebough N, H(N) ~ H(N+x) for all x>0 Which would imply that sum( 1/k ) (from 1 to n) is a Cauchy sequence in in R (which is a complete metric space). It would then imply that this sum converges. But it clearly diverges... so what am I missing?

    • @LinesThatConnect
      @LinesThatConnect Před 3 dny

      This is something I wish I had presented a little differently. It's not that if you choose a large enough N, then the approximation holds for all x. Rather, given any x, you can find N large enough that it holds. Larger x will require larger N.

    • @RickGGb1
      @RickGGb1 Před 3 dny

      @@LinesThatConnect oh I get it :)

  • @noedig101
    @noedig101 Před 3 dny

    The Vsauce theme at 10:38 cracked me up so hard, I thought I was gonna die of laughter. Then the "or is it?" happened and I actually did.

  • @fn9869
    @fn9869 Před 4 dny

    ive been thinking of investigating this myself! im so happy to see this video

  • @afxtw1n
    @afxtw1n Před 4 dny

    not bad, and always psyched to see an homage to grant and manim, but you could have found a slightly different font, manner of speaking, timing, and general format than litterally exactly the same as 3b1b. use the same brush as monet, but make new art with it. it's distractingly familiar, like the uncanny valley.

  • @bloodakoos
    @bloodakoos Před 4 dny

    that would be the bubble, stupid

  • @noahwhelpley2926
    @noahwhelpley2926 Před 4 dny

    I've wondered about this for years, thank you!

  • @kingofgoldnessr9364

    Omg I remember trying to create sin(x) out of products of linear functions after learning about multiplicity in high school. I was too stupid to fix the scaling issue sadly 😂

  • @DeclanCC
    @DeclanCC Před 5 dny

    When seeing a name like "Lines that connect" I was kinda hoping for some big conspiracy theory... but I just found good work, keep it up bro.

  • @Ropsuguy
    @Ropsuguy Před 6 dny

    Now where is the best sorting algorithm based not on what sorts fastest, but what makes the funniest noise?

  • @NoenD_io
    @NoenD_io Před 6 dny

    Hey check this out🚓🚓🚓🚓🚓🚓🚓🚓🚓🚓🚓🚓🚓🚓🚓🚓🚓🚓🚓🚓🚓🚓🚓🚓🚓🚓🚓🚑🚓🚒🚑🚒🚕🚑🚒🚓🏎️🚑🚒🚓🏎️🏎️🏎️🚑🏎️🚑🏎️🚓🏎️🏎️🏎️🚓🚓🚒🚓🚒🚑🏎️🚑🏎️🏎️🏎️🏎️🏎️🏎️🏎️🏎️🏎️🏎️🏎️🏎️🏎️🏎️🏎️🏎️🏎️🏎️🏎️🏎️🏎️🏎️

  • @justinneves3902
    @justinneves3902 Před 6 dny

    sigma

  • @rishabtirupathi9431

    16:00 WHAT THE HELL?!?!? He just got to the formula, just like that?! With a few assumptions and a few rearrangements?! That's CRAZY!

  • @wesleysays
    @wesleysays Před 7 dny

    Let’s create the longest reply chain ever

  • @Hositrugun
    @Hositrugun Před 7 dny

    I'm confused, in the transition from 18:02 to 18:03, why does the sigma get replaved by an 'n'? I get that since the function being summed no longer has a 'k' in it, the sum notation can be dropped, but why is the "No longer being summed" L(N) then multiplied by n? Where does that come from?

    • @LinesThatConnect
      @LinesThatConnect Před 7 dny

      The sum adds ln(N) once for each k value: k=1, k=2, k=3, ... up to k=n. So in total we're adding it n times, giving us n×ln(N).

    • @Hositrugun
      @Hositrugun Před 7 dny

      @@LinesThatConnect Thanks for the reply, that explains it perfectly!

  • @ErdemtugsC
    @ErdemtugsC Před 8 dny

    Best things in math: 1-“Let’s put a box around it” 2- cleaning up and simplifying a mess

  • @itryen7632
    @itryen7632 Před 8 dny

    We sorting now, baby! LET'S GO! ELT'S GO! EGT'S LO! EGL'S TO! EGLS TO!' EGLO ST!' EGLOST!'

  • @MrSofazocker
    @MrSofazocker Před 8 dny

    I always do a bogosort first... you know.. you might get lucky one day.

  • @PrimordialOracleOfManyWorlds

    is the euler-mascheroni constant related to a fractional or divisible multiple of e or pi or phi or even a trigonometric value like sin, cos, tan or sinh, cosh, tanh value? it looks too familiar, and it makes you constantly think.

  • @jayplayzlol8701
    @jayplayzlol8701 Před 8 dny

    I may not have understood much but it's all fascinating

  • @berenscott8999
    @berenscott8999 Před 8 dny

    Technically each iteration is faster then the previous. Technically if the if statement is true, then that iteration will take more time if more true outcomes. The reason bubble sort is inefficient is because of how CPU's process if statements. Basically, both true and false outcomes are extrapolated. Both outcomes exist. Over time perhaps the CPU will decide that false occurs more then true. So it will lean into false and backtrack whenever it's true. It's convoluted, but this is why bubble sort is inefficient.

  • @Idontdeserveanylikewhy

    Ik this cuz I accidentally click ! On Samsung calculator and I try it with 10! And the number is 1million+ and I try to figure out what is this thing

  • @Aesthetycs
    @Aesthetycs Před 9 dny

    A method via recursive equality… I think I’ve seen it somewhere !

  • @straft5759
    @straft5759 Před 9 dny

    Well, well, well, if it isn't Hyperbola

  • @LOL_1243
    @LOL_1243 Před 10 dny

    Blud did not skip a single math class Nice vid

  • @bryanandhallie
    @bryanandhallie Před 10 dny

    Holy cow he is good at transitions

  • @ozzymandius666
    @ozzymandius666 Před 11 dny

    I love getting detailed answers to strange and obscure questions that I never though to ask. Fascinating.

  • @themike97_58
    @themike97_58 Před 12 dny

    That curve is obviously the bubble. Duh.

  • @Swcher
    @Swcher Před 12 dny

    mmmmmmmmmm, Neopolitan sorting algorithms

  • @frostz3307
    @frostz3307 Před 13 dny

    that was...... genius.... holllyyyyyyyyyyy

  • @frostz3307
    @frostz3307 Před 13 dny

    Or is it..... LMAOOOO

  • @JimmyBin3D
    @JimmyBin3D Před 13 dny

    When I watch the bubble sort "bubble," my brain intuitively understands what's happening and why, but I can't for the life of me follow any of the math behind it. Why is my brain capable of understanding something intuitively that it can't understand mathematically?

    • @theendofthestart8179
      @theendofthestart8179 Před 5 dny

      you dont have to believe me, but the signals in your brain are LITERALLY bypassing the logic sectors

  • @SmashingCapital
    @SmashingCapital Před 14 dny

    What if you extend to complex numbers

    • @dabidmydarling5398
      @dabidmydarling5398 Před 7 dny

      There is an elegant technique for differentiating under the integral sign that allows u to transform the sum into an integral--which makes it easier to compute complex inputs.

  • @ShannonJacobs0
    @ShannonJacobs0 Před 14 dny

    Equal time per iteration assumption is bogus. No one would code it that way. Obvious comment but I'm not going to sort the 4-digit sock puppet comments. Sufficient to note that the first one is such.