Coding Challenge

Sdílet
Vložit
  • čas přidán 25. 08. 2024

Komentáře • 541

  • @arkamitra4345
    @arkamitra4345 Před 5 lety +1154

    You can use bully sort:
    Choose the first element.
    Delete the rest of the elements.
    Your array is now sorted.

    • @mistermixter4123
      @mistermixter4123 Před 5 lety +12

      Lol

    • @yangyang6140
      @yangyang6140 Před 5 lety +6

      Arka Mitra Brutal, I like it.

    • @ashishthapamagar9166
      @ashishthapamagar9166 Před 5 lety +8

      You're genius man.😂😂

    • @EnteiFire4
      @EnteiFire4 Před 4 lety +25

      Similarly, there's Stalin sort:
      Remove all the elements smaller that the last "kept" value. For example :
      5, 3, 8, 9, 1, 2, 10 becomes 5, 8, 9, 10.

    • @NachoMan154
      @NachoMan154 Před 4 lety +27

      Communism sort is: Choose the least element, assign the value to all other elements. The Array is now Sorted. xD

  • @kyraaa__
    @kyraaa__ Před 4 lety +161

    Thanos sort: delete half and sort the rest! It’s twice as effective

    • @sortof3337
      @sortof3337 Před 4 lety +1

      ha ha ha. I am gonna try and implement this.

    • @tobiasgorgen7592
      @tobiasgorgen7592 Před 4 lety +1

      def ThanosSort(list):
      {
      while not list.isSorted()
      {
      cullHalve(list)
      }
      return
      }

    • @dairop3220
      @dairop3220 Před 3 lety +1

      Well i fact sorting isn't linear so it's more than twice effective :)

    • @shanewalsch
      @shanewalsch Před 3 lety

      And use recursion next, so that the complexity will be O(log n)

  • @kostasgeorgiou2417
    @kostasgeorgiou2417 Před 6 lety +1152

    📂Documents
    └📁Videos
    └📁 The Coding Train
    └📁 Bad Videos
    └⚠️ This folder is empty

  • @e4r281
    @e4r281 Před 6 lety +456

    I wish I could bubble sort the stuff in my room.

    • @aggbak1
      @aggbak1 Před 6 lety +5

      jordan peterson approves

    • @giorgosd3624
      @giorgosd3624 Před 6 lety +3

      Me too, i can only bubble sort a coca-cola

    • @stepan981
      @stepan981 Před 6 lety +5

      Eh... Kinda slow.

    • @nevermind1O844
      @nevermind1O844 Před 5 lety +17

      pro tip: lock that door, find a new room, forget about the old one... maybe garbage collection kicks in

    • @sonicfon
      @sonicfon Před 4 lety

      quick sort for you. Or if you bored, gravity sort it.

  • @SriNiVi
    @SriNiVi Před 4 lety +29

    As a software developer I just love his thinking approach to an Algorithm. Morover just love to see how happy he is while doing this and how much he's enjoying this..
    Big fan.

  • @awsomeguy563
    @awsomeguy563 Před 6 lety +376

    HOLY CRAP! HE'S FINALLY DOING SORTING ALGORITHMS

  • @PsychoticBufoon
    @PsychoticBufoon Před 2 lety +2

    I didn’t understand a lick of the computer science, but I was entertained throughout

  • @dielfonelletab8711
    @dielfonelletab8711 Před 6 lety +86

    😮 For the first time ever I did something before Dan inspired me to. I feel like a true programmer now!

  • @rikkiegieler5638
    @rikkiegieler5638 Před 6 lety +194

    I suggest:
    Merge Sort
    Heap sort
    Bogo sort and BogoBogo sort ;-)
    Sleep sort
    Gravity/Bead sort
    Comb sort
    Slow sort
    Insertion sort

    • @giorgosd3624
      @giorgosd3624 Před 6 lety +7

      Rikkie Gieler Dont forget Miracle sort

    • @Triavanicus
      @Triavanicus Před 6 lety +16

      Why not Radix sort as well

    • @MasterHigure
      @MasterHigure Před 6 lety +5

      Don't forget Intelligent Design sort.

    • @mikeberezhkov7810
      @mikeberezhkov7810 Před 6 lety +5

      sorting with ML. Why not to try?

    • @blasttrash
      @blasttrash Před 6 lety +2

      And then visualize all of them in a parallel sort way as well. like simulating multiple processors and what not.

  • @ekarademir
    @ekarademir Před 6 lety +7

    Daniel, you made me smile! Thanks for all your efforts.

  • @DigitalNerd
    @DigitalNerd Před 2 lety +1

    Dude just did an entire weeks worth of my programming homework in one sitting, added great commentary and instruction the entire time, recorded a fun video and I was still completely more interested in this than doing my own homework. Good shit

  • @Louis_Marcotte
    @Louis_Marcotte Před rokem

    I've been watching your challenge videos for a while, watching until I understand what it is, actually researching and coding them and then looking at what you did. Pretty fun way to spend/procrastinate through a couple hours

  • @glendale87
    @glendale87 Před 6 lety +1

    Sorting visualizations are so relaxing! Awesome vid :)

  • @goldenfreddy8649
    @goldenfreddy8649 Před 6 lety +1

    I took a basic computer science class because I needed the credit. We actually used a couple of your videos as references. Now I have a somewhat newfound interest in computer science once again, and these videos are actually pretty intriguing.

  • @Otakutaru
    @Otakutaru Před 6 lety +2

    I LOVE you! Sorting algorithms are too much fun

  • @kedarkodgire9506
    @kedarkodgire9506 Před 4 lety +1

    My goodness , each video of yours is mesmerizing. I kinda keep watching it till the end even if i don't understand some stuff in between.
    **most important note is I never get bored of your videos 😅**
    You're amazing!!!!!

  • @DSan96
    @DSan96 Před 5 lety +52

    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

  • @provolke
    @provolke Před 6 lety +31

    You should do a soduko solver! Ive been trying to make one thats a 3x3 for awhile. I wanna try to do it very eligantly.

    • @amrsaber5457
      @amrsaber5457 Před 5 lety

      It gets solved fairly efficiently by backtracking, you should try that.

    • @alcxander
      @alcxander Před 5 lety

      @@amrsaber5457 whats backtracking in this context?

    • @TheFrankvHoof
      @TheFrankvHoof Před 5 lety

      @@alcxander try m.czcams.com/video/auK3PSZoidc/video.html

    • @BenMcHone
      @BenMcHone Před 2 lety

      @@alcxander Essentially you fill in any number that will currently work in a cell and assume that it's correct. Then you keep filling out the board until you fail, take a step back, try a different number, repeat. You can backtrack all the way to cell #1 if you are unlucky, but this is a slightly more elegant brute force.

  • @tanyastaneva1500
    @tanyastaneva1500 Před 6 lety +38

    Please do the radix sort :)

  • @ElZafro_
    @ElZafro_ Před 6 lety

    The animation using the noise blew my mind. So cool!

  • @marowakcity3727
    @marowakcity3727 Před 2 lety

    “Bubble sort is probably the least efficient sorting algorithm”
    Bogosort has entered the chat

  • @suzumow
    @suzumow Před rokem

    You are amazing. That was hella fun! Thank you very much.

  • @OrangeC7
    @OrangeC7 Před 6 lety +9

    Actually, the least efficient sorting algorithm is the random sort.
    *pushes glasses up nose*

    • @Qwentar
      @Qwentar Před 5 lety

      BogoSort. I suspect the Bogo stands for Bogus.
      Surprisingly it can work for short lists (less than ten elements).

    • @NStripleseven
      @NStripleseven Před 4 lety +2

      Nah, miracle sort is worse. "Is it sorted yet? No? Okay, wait, do nothing, wait a minute, and check again.

  • @LillyCode
    @LillyCode Před 3 lety

    I just love your energy, from a 31 year old, 3 year professional coder, going over these basics with that sun in the background and you dancing.
    Kalabunga what fun learning.
    Annnd pretty sure I won't have to go over this basic again as you have imprinted it..... so therefore, on to allll your other videos to get that same level of imprint. THANK YOU.
    I am subscribed and liked and shall continue to like, great great educational, so fun, content. The dances just get me and nervous hahaha been at this for 3.5 hours now, thank you for your time.
    Super.

  • @ipoop4359
    @ipoop4359 Před 4 lety +1

    YOU’RE THE BEST TEACHERRR
    PERIODTTTT

  • @Cool_Story_Bruh
    @Cool_Story_Bruh Před 5 lety +1

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

  • @BUZZYBG
    @BUZZYBG Před 4 lety

    You make coding much more fun!! Keep being yourself!

  • @yesveryprofesionalnameyes6055

    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

  • @mitalisharma440
    @mitalisharma440 Před 3 lety

    these are so cool. like the energy is contagious and the teachin is so goood. thenkssssssss

  • @user-yq8xh
    @user-yq8xh Před 6 lety +2

    Your videos are awesome, I have learned so much by watching them! I would love to see a videos series on assembler programming. I did not understand this stuff till now, but I know if you were my teacher I definitely would. :-)

  • @adibahmed10
    @adibahmed10 Před 4 lety

    Visual sorting algorithms are like crack for my OCD. I love it!

  • @poof65
    @poof65 Před 5 lety

    This is really a subject that I find interesting. When I was younger I loved to do sort visualizations (and fractals) . You gave me the motivation to continue :)
    Apart from that, you're very energetic, funny and passionated, keep up the good work

  • @mrbrown6421
    @mrbrown6421 Před 2 lety +1

    Thank you sir, greatly enjoyed.
    There was a time I wrote code just like that...
    in machine code, before there was C compiler.
    More addicting than games, because there
    were no games...long into the dark and tired night.
    No source control, no internet.
    I greatly miss it.
    11.27.21

  • @aissagasmi4144
    @aissagasmi4144 Před 6 lety +6

    i lik your explication method it is amazing ...no boring thnx

  • @DavidSuper13
    @DavidSuper13 Před 6 lety

    the merge sort looks really incredible

  • @faville
    @faville Před 2 lety

    I don't know what the hell is going on here, but it's cool to see what goes on behind those neat sorting animations that keep popping up in my feed. I never made it past the first couple of Hour of Code levels.

  • @ageklopstra6153
    @ageklopstra6153 Před 6 lety +5

    More sorting videos please!

  • @junaidchoudhary9110
    @junaidchoudhary9110 Před 6 lety +1

    09:23 that jump though, it feels so relatable..lol

  • @WildAnimalChannel
    @WildAnimalChannel Před 6 lety

    I like watching these videos. It's relaxing.

  • @deepakpandey9406
    @deepakpandey9406 Před 5 lety

    This guy is crazy but one of the best tutor 😎

  • @nicholas_scott
    @nicholas_scott Před 6 lety

    Loved this. Takes me back to college. I think every freshman has to make a visual bubble sort so the prof can detail how ineffecient it is

  • @addyad_yt
    @addyad_yt Před 3 lety

    I don't even know what is processing programming language is but I see his videos for months now to understand the logic then I'm trying recreate it in MATLAB.

  • @DevinTyler_2
    @DevinTyler_2 Před 6 lety +3

    YESSSS!!!!! Visualize ALL OF THE SORTS!

    • @user-mn3iq2cs9n
      @user-mn3iq2cs9n Před 6 lety

      Insertion, Merge, GO GO GO!

    • @Kiotiify
      @Kiotiify Před 6 lety

      czcams.com/video/SJwEwA5gOkM/video.htmlm36s Enjoy this clip from Sorting out Sorting....

  • @isthisajojoreference7763

    What's this treasure I've stumbled upon

  • @UnrealOG137
    @UnrealOG137 Před 3 lety

    Stalin sort:
    Go through the list, and simply delete elements which are out of order.
    Your array is now sorted.

  • @Vairoon
    @Vairoon Před 4 lety +1

    Fast sort:
    until [done] do
    shuffle (not right placed)
    end

  • @MarkoFire123
    @MarkoFire123 Před 6 lety +2

    Queen of sorting!

  • @canaDavid1
    @canaDavid1 Před 5 lety +1

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

  • @ABaumstumpf
    @ABaumstumpf Před 6 lety

    It is nice how the simple lines at 5:25 show the problem with the used "Random" function of java - for most applications it is fine, but the numbers do exhibit a pattern.

  • @MartynCole
    @MartynCole Před 4 lety

    You can also keep track of whether there is a swap or not. If not you can terminate the sort.

  • @10tens5
    @10tens5 Před 5 lety

    I dont even know what's happening but this amazes me!

  • @Danacus
    @Danacus Před 6 lety +4

    Sorting algorithms! Something I was planning to do! I'm curious to see how the algorithms work.

  • @haythamkenway8343
    @haythamkenway8343 Před 4 lety

    This guy is a legend.

  • @kayleeemantsal358
    @kayleeemantsal358 Před 4 lety

    no clue about any of this stuff, but i love your personality so i watch anyway, youre awesome

  • @ravencircles4611
    @ravencircles4611 Před 6 lety

    I did this on a 3ds in 20 minutes these sort algs are fun

  • @firephoenix5556
    @firephoenix5556 Před 5 lety

    somehow, there's something so magical about you saying "I just sorted this with a bubble sort"

  • @jeeaile5835
    @jeeaile5835 Před 6 lety +2

    Awesome video from France !

    • @fabu4792
      @fabu4792 Před 6 lety

      BON JOOR MISS SURE. COMA SA VA!

  • @derpmarine216
    @derpmarine216 Před 5 lety +4

    16:37 moves invisible laptop

  • @undefined6947
    @undefined6947 Před 3 lety

    The least efficient sorting algorithm as far as I know is not bubble sort, it's random sort. This randomizes the order of the array, checks if it's in order, if not then it randomizes it again. This method is n! or n factorial, which is much more than n². 7! for example would be 1*2*3*4*5*6*7 which is 5,040, whereas 8! is 40,320. An array of 8 needs an average of 40,320 operations to sort... Crazy.
    There is basically no reason to do this except fun as far as I know.

  •  Před 5 lety

    and i thought sorting algos would be boring. but with these visualizations?! Damn, Imagination is the limit!

  • @CristiNeagu
    @CristiNeagu Před 4 lety

    That swap function is one of the reasons Python is the best.

    • @CristiNeagu
      @CristiNeagu Před 4 lety

      Why, you ask? Because swapping two values in Python is:
      a, b = b, a

  • @prakharpandey2392
    @prakharpandey2392 Před 6 lety +1

    Hey Dan I'm almost selected for the National level Coding Championship. 😍😍
    All thanks to you and my school teacher😍

    • @Khokhar1967
      @Khokhar1967 Před 5 lety

      are you into compettitive programming?

  • @mohanish35
    @mohanish35 Před 6 lety

    My worst nightmare would be to open CZcams and don't find this channel.

  • @codeforest9027
    @codeforest9027 Před 5 lety +4

    As I goes up...
    My grammar instincts kick in

  • @vighnesh153
    @vighnesh153 Před 4 lety

    You can probably use generators using the yield keyword to make the visualization of each step simple.

  • @rosslahive
    @rosslahive Před 5 lety

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

  • @user-wm2tq4wn1p
    @user-wm2tq4wn1p Před rokem

    A tip, each subsequent pass only needs to traverse until the last swap, not until the decrementing index. Also, you will know you are at the end if a pass did no swaps.

  • @quarkstuff
    @quarkstuff Před 4 lety

    Bubble Sort is not the worst, that goes to Bogosort, whose Big O notation is "(n + 1)"! [the reason is because it randomizes the order of the list until it is sorted]

  • @astrotoaster5555
    @astrotoaster5555 Před 6 lety +1

    Please do a video of the quickest sorting method, with this same format please

  • @xnick_uy
    @xnick_uy Před 6 lety

    This was very nice. I was thinking about creating a "genetic algorithm sort" next, combining some of your former videos and this one :P

  • @balla2172
    @balla2172 Před 5 lety

    Man I wish I knew coding/programming has as good as you. I'm trying to teach myself python now. I hope to get to this level some day

  • @danielettrup3002
    @danielettrup3002 Před 6 lety +69

    Background(0) ?? Er you okay Daniel? Why not 51?

    • @TheCodingTrain
      @TheCodingTrain  Před 6 lety +19

      haha!

    • @4pxris3
      @4pxris3 Před 6 lety +7

      @@TheCodingTrain uhh i cringe everytime someone puts a exclamation mark at the end of haha or xd.

    • @danielettrup3002
      @danielettrup3002 Před 6 lety +13

      haha xd

    • @blinzi69
      @blinzi69 Před 5 lety +1

      this comment has 51 likes lmao

    • @muranki1293
      @muranki1293 Před 5 lety

      @@blinzi69 I wouldn't want to ruin that

  • @soparado3676
    @soparado3676 Před 6 lety +3

    Great work Dan! Could you try to visualize the Radix Sort?

  • @lupinedreamexpress
    @lupinedreamexpress Před 4 lety

    3:38 correction not just how long it performs but how many accesses, comparisons, and where the data is access plays a part for one reason: storage media. Rotational drives like algorithms that dont have to move the spindle around the surface constantly or that access data sequentially. Hybrid drives love algorithms that use the beginning of the set as a temporary storage space (solid state occupies the first 10-20% of the drive), NAND and VNAND love algorithms that break themselves up into evenly spaced blocks (blocks of data). Sometimes it's not exactly how long it takes to complete a sort, minimizing damage to your storage media matters at the data center which is how and why many of these sorting algorithms came to be in the computer science world.
    Hundreds of trillions of disk accesses matter to drive life over time. Big databases enjoy the reliability and benefit of a smartly chosen sorting alogirhtm.
    FYI the fastest in volatile memory (RAM) for those concerned is pigeonhole. 4000 accesses and 0 comparisons. If you have a mechanical drive that's new, choose Radix (all base forms of RADIX produce sequential, rotational movement during access times when graphed during sorting) , if you've a hybrid drive for your data set, choose WikiSort (first 10% of the set is used as the comparitive area) . Proper choices will preserve the life of your drive.

  • @dfordemo981
    @dfordemo981 Před 4 lety

    making videos super interesting, cool guy, we really had enjoyed your videos.

  • @elliotardouin-nesbit5657

    Babe, its 3am, time to watch hours of sorting videos

  • @jacksonweidmannmann5113

    the most inefficient sorting algorithm is actually the random sort. You rearrange the array randomly and check if it's sorted. I believe the computation time grows at n!

  • @quack3891
    @quack3891 Před 3 lety

    I've seen Cube Sort and then there's Slowsort.
    Both were interesting.

  • @m4rt_
    @m4rt_ Před 2 lety

    10:00 you don't need j, you just need i. then just have a boolean saying if everything is sorted, then just end it if that boolean is true (it is sorted)
    every time you check if it is sorted, if you didn't have to swap then keep it true, but if you had to swap then make it false, and when you reset i to 0 check if sorted is true, if it is true then you didnt have to swap anything and it is all sorted, but if it is false, then set it to true and go over the array again

  • @jordancobb509
    @jordancobb509 Před 4 lety

    How long the sort takes depends on the values. If they are already mostly I'm order a bubble sort can complete in only a few passes. Use the correct sorting algorithm for your data.

  • @redhen
    @redhen Před 6 lety

    Watching this video features heavily, very heavily, on my to-do list today. Thank you, Dinael Shufflepins. X

  • @JinTsen
    @JinTsen Před 6 lety +10

    Why is this video not listed?
    anyway, the growth isn't exponetially, it's quadratic or polynomial, more generally speaking.

    • @TheCodingTrain
      @TheCodingTrain  Před 6 lety +8

      Ack, I always make this mistake, thank you for pointing it out. I'll add a note to the description. (I leave videos online and unlisted for a bit while I prepare captions etc. I like to release only one video per day but happy for people to find them in advance.)

    • @JinTsen
      @JinTsen Před 6 lety +1

      I see, thanks for the explanation :)

  • @nithinsravan596
    @nithinsravan596 Před 6 lety

    Awesome!!! Man love your channel 🔥😁

  • @ilabenmachhar4744
    @ilabenmachhar4744 Před 4 lety

    Numbers algorithms that I show in so many computer screen

  • @Morpheus396
    @Morpheus396 Před 6 lety +1

    Oh how I wish this was available when I did sorting algorithms last year! Great vid.
    *Ps I'm a proud owner of a copy The Nature Of Code :)

  • @beatalert123
    @beatalert123 Před 4 lety

    Wow.... I have never ever seen someone using processing other than using it while programming an Arduino :D Took me back to college :D

  • @torrin4615
    @torrin4615 Před 5 lety

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

  • @danielstromberg
    @danielstromberg Před 4 lety

    Timsort. It's the main sorting algorithm used by Python and Java now.

  • @davidbuzatto
    @davidbuzatto Před 6 lety

    A pretty nice thing to try is to implement some kind of temporal control, so you can go forward or backward in the sorting process. Give it a try 😊

  • @piyushnegi8121
    @piyushnegi8121 Před 5 lety

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

  • @frenzy9741
    @frenzy9741 Před 5 lety +1

    El julioprofe de la programacion

  • @mickyr171
    @mickyr171 Před 6 lety +6

    I really really want to see you do Delaunay triangles Daniel, easy as on paper, not so easy in programming lol

  • @linx3519
    @linx3519 Před 4 lety

    This dude reminds me of professor from movie where he decode some alien invasion plan. Same level of hype

  • @paulz.6162
    @paulz.6162 Před 6 lety +1

    I'd love to see this done for Radix or Bucket Sort

  • @Raikuthedragon
    @Raikuthedragon Před 5 lety +1

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

  • @roshanpawara8717
    @roshanpawara8717 Před 6 lety +6

    Come on bubble sort you can do it!!

    • @Qwentar
      @Qwentar Před 5 lety

      "The Sorting Algorithm That Could"

  • @t74devkw
    @t74devkw Před 5 lety +2

    Do you plan you continuing these series? It's so helpful

  • @comocrearunacarpeta
    @comocrearunacarpeta Před 6 lety +9

    Soy de México y estoy estudiando la universidad, curso la carrera en Ciencias de la Computación, conocí tu canal hace no mucho tiempo y me encantó, eres increíblemente ingenioso y muy rápido, con una habilidad tremenda para programar, me la paso viendo tus videos pero mi nivel de inglés aún no es tan bueno como para entender todo lo que dices :(, ojalá que algún día exista un canal en español o yo aprenda bien inglés jaja, en fin quería decirte que incluso a hispanohablantes asombras con tus habilidades de programación. Éxito.

    • @tomborninger1752
      @tomborninger1752 Před 6 lety

      David López González tengo classes en espanol.

    • @rafaelmorales1926
      @rafaelmorales1926 Před 6 lety +6

      Let me translate for you guys:
      "I'm from mexico, and I'm studying in college computer sciences. I found your channel not so long ago and I loved it, you're really clever and fast, with a tremendous ability to code things. I spend a lot of time watching your videos but my english is still not so good to understand everything you say :(, hopefully someday there is an spanish channel like yours, or I learn english haha. Anyway I wanted to tell you amaze that even to spanish-speakers with your skills."

    • @Mumumuth
      @Mumumuth Před 6 lety

      面白い。。。

    • @t1mk1ll3r4ll
      @t1mk1ll3r4ll Před 6 lety

      HEROE!

    • @Mikenight120
      @Mikenight120 Před 5 lety +2

      Yo tambien estoy estudiando en la universidad Ciencias en computadoras solo que estoy en Puerto Rico
      metele fuerte al ingles lo vas a necesitar mucho para la programmacion y las oportunidades que vas abrir al entender mejor el ingles con la programmacion

  • @sudhanshusharma9123
    @sudhanshusharma9123 Před 4 lety

    How do you make everyone laugh even while coding.

  • @MrAwesomesize
    @MrAwesomesize Před 6 lety +9

    Bogosort please!