Sorting Visualizer with Sound (JavaScript Tutorial)

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

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

  • @Radu
    @Radu  Год назад +12

    Check out the 3 visualizers and their source code on my website :-)

  • @pesterenan
    @pesterenan Год назад +6

    The end goal is so awesome! I guess people don't appreciate how much effort you put in these videos. Every little hint, like changing attributes in the inspector before changing them on the code, or abstracting away and calling the functions using arguments, that is so important in web dev, and you make it look so natural, this is really wonderful!

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

      Thank you. Means a lot :-)
      After doing videos for a while, I also look differently at other creators. There's a lot of thought going on behind the scenes that people don't really notice.

  • @sourav_-_7038
    @sourav_-_7038 Год назад +1

    man your sense of humor is innocent and your calm nature is fun to watch.

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

      I knew it! I do have a sense of humor.

    • @sourav_-_7038
      @sourav_-_7038 Год назад +1

      @@Radu do some distributed programming project. like in real how fb uses messenger.

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

      Will consider it, thanks!

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

    I swear I was searching for this a month ago RADU IS A LEGEND

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

      Good you found what you were looking for :-)

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

    i always has the starting music stucked in my head for a while, Coding with Radu, coding with Radu 🎵🎶🎵🎶🎶🎶 Thanks Radu, nice video, waiting for the next.

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

      Haha :-) guess I made a hit!

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

    I will never not laugh at the _"Get it? Because of this? oh no no no!"_ hahahahah

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

      I have several videos recorded already where I don't do it, but... maybe I'll try to do it more often in the future :-)

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

    Very good video. I have developed a sorting visualizer project. And this was the first video I watched last year that motivated me and taught me how to approach the project. Very good explanation.

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

      Glad it was helpful!

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

    I love your content. You mix all my favorite subjects together: mathematics, computer science, data science, and web development. Great job!

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

      Great to hear :-) Thanks for watching!

  • @MatiasSomoza-zo9op
    @MatiasSomoza-zo9op Год назад +1

    You are awesome, it's so abstract and boring to learn data structures and algorithms and only being able to watch endless nested objects in the console; I've been looking for this kind of content for the last year and a half. Thank you!!

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

      Great to hear it helped you out :-)

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

    very well explained just finished the project and it is working really great

    • @Radu
      @Radu  9 месяцев назад

      Great to hear!

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

    Another great video!
    I also like all sorts of puns you make at the beginning of your videos... Get it? All *sorts* ? Because this video... No, no, no...

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

      Experimenting with those puns from time to time. Maybe I'll make it a habit on the channel :-)

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

      I like the puns, please do

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

    Just simply put the code, it works! thanks!

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

      You're welcome!

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

    Amazing tuto, I've just redid it with Canvas and Typescript and implemented the insertion algorithm, you inspire me a lot, thank you

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

      Awesome! I would also like to visualize more algorithms. Maybe I will at some point :-)

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

    This is my first time practically using a do while loop

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

      It might be the first time I used one in a RUclips video :-D not 100% about that.

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

    the logging mechanism is a really good idea thank you Radu :D

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

      You're welcome :-)

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

    Keep going radu, we're loving your creativity .Love and support from ⚪🟠🟢 🇮🇳. ♥♥♥

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

      Thanks :-)

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

    Oh yeah!

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

      Glad to see you're excited :-)

  • @AmanSingh-fm1lw
    @AmanSingh-fm1lw Год назад +1

    Great teaching sir...need more projects like these...love learning from you...

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

      Thank you :-) more will come!

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

    Hey Thanks Radu, I have followed u r lecture and written code Thanks man

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

      Glad to hear that!

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

    i really apreciate your help with dowloanding this software

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

      You can go to my website (linked in the description) and look for the sorting visualizers. You can download the code if you register on the website... but also if you right click and save the page locally on the computer (so, no login really necessary).

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

    Love your content! I would love to see and play that sorting algorithm game.

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

      Ok, noted. Let's see when I have time for this one!

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

    wow! as always you suprise us with new and fresh content.

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

      I always had a feeling that sorting visualizers are... old news. But maybe I can do something different, let's see!

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

    Great video (as always)! I always learn a lot from your videos!

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

      Good to hear!

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

    17:36 I didn't understood why we need another copy of the array ? Can you please explain that again? Please !?

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

      Because the original gets sorted when collecting the moves. We need to reproduce these moves during the animation on the same array we had in the beginning. That's why we need a copy.

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

      @@Radu Oh ! Now I get it. Thanks a lot!

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

      @@kafkatamura2461 No problem :-)

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

    Thanks for such an amazing video sir

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

      Thanks for watching :-)

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

    Thanks! Easy and clear tutorial!

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

      You're welcome!

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

    Like always your video is an inspiration, so fill of content and so well explained, thanks.

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

      Happy to hear :-)

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

    works, chock-full thanks!

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

      You're welcome!

  • @prajwalbhat3737
    @prajwalbhat3737 14 дней назад +1

    I tried to add it to all the sorting algorithms
    But I am getting error for selection and merge sort

    • @Radu
      @Radu  11 дней назад

      I do have a video where I show how to adapt it to... quicksort and... insertion sort (if I remember right), using ChatGPT. Let me know if you can't find it on my channel.

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

    Learnt a lot. Thanks! ❤❤

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

      You're welcome 😊

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

    Awesome! Thank you!

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

      You're welcome!

  • @nizamuddinkhan7408
    @nizamuddinkhan7408 3 месяца назад +1

    this project creates a random array i want to make it as per the users input how can i do that - i mean user will enter the array size and elements

    • @Radu
      @Radu  3 месяца назад +1

      Well... it depends what UI elements you want to use.
      Maybe using an input field where you separate numbers by comma ',' and then parse it to separate according to the comma using split.

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

    Really cool video! Thank you!

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

      Glad you liked it!

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

    function quicksort(arr, left, right) {
    const swaps = [];
    var p;
    if (arr.length > 1) {
    p = partition(arr, left, right, swaps);
    // animate(swaps);
    }
    if (left < p - 1) {
    quicksort(arr, left, p - 1);
    }
    if (right > p + 1) {
    quicksort(arr, p + 1, right);
    }
    return swaps;
    }
    function partition(arr, left, right, swaps) {
    var pivot = (left + right) / 2;
    var i = left;
    var j = right;
    while (i

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

      I'm on holiday and won't be testing any code anytime soon, but I think your pivot should be Math.floor((left + right) / 2); otherwise you'll get problems when you try to access floating point indices in an array.

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

      @@Radu thnxs

  • @martitrasmonte9851
    @martitrasmonte9851 7 месяцев назад +1

    I know its a year late but ... its possible to adapt this visualizer to a non- swapping sorting algorithms like insertion sort, quick sort or bucket sort ?

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

      I *think* that all in-place sorting algorithms swap things around.
      And, I did do this video recently: ruclips.net/video/of0CBt4RDM4/видео.html

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

    I added a new effect to the animation when this is over. in the
    if (moves.length ==0) . changed it to.
    if (moves.length == 0) {
    const bars = document.querySelectorAll(".bar");
    for (let i = bars.length - 1; i >= 0; i--) {
    const bar = bars[i];
    const previousBar = bars[i + 1];
    setTimeout(function() {
    bar.style.backgroundColor = "green";
    playNote(200 + array[i] * 500);
    if (previousBar) {
    previousBar.style.backgroundColor = "black";
    playNote(200 + array[i+1] * 500)
    if (i == 0){
    bars[0].style.backgroundColor = "black";
    }

    ;}


    }, 100 * (bars.length - i));

    }
    return;
    }

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

      Nice :-) the green bar going from right to left and the melody mark that the sorting was done!

  • @sergiyrudenko905
    @sergiyrudenko905 11 месяцев назад

    Radu, thank you very much!!! Great video!!!

    • @Radu
      @Radu  11 месяцев назад +1

      Thanks! :-)

  • @Upendrachauha23
    @Upendrachauha23 7 месяцев назад +1

    Thanks ❤❤❤❤

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

      No problem :-)

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

    Speechless😮

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

      Glad you liked it :-)

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

    Most awaited video man

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

      Yeah, hope it was worth it :-))

  • @JohnDoe-gl5mk
    @JohnDoe-gl5mk Год назад +1

    Great video Radu ! I was wondering if you have done any implementations with other sorting algorithms (insertion, merge, quick, heap, etc.) that preserve the cool audio effects from this bubble sort algorithm.

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

      No, but this visualizer is so generic it can be applied to any sorting algorithm. You just have to log which swap is made and then it will be replayed afterwards.

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

    Very interested in the AudioAPI part, I’ll check your video on it !

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

      Ok. I hope it was explained well enough there... haven't seen that material for a while. Let me know if I should redo it!

  • @MohitVerma-nq8hn
    @MohitVerma-nq8hn Год назад +1

    Great video ❤️..I have a doubt my bubble sort keep on happening even if I press init button. How to reset it.

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

      You would need to store the timeout into a variable. Let's call it 't'. Then, you can call clearTimeout(t); to stop the animation.

    • @ABHAYSINGH-zy7pl
      @ABHAYSINGH-zy7pl 11 месяцев назад

      @@Radu can u explain it any further i dont quite get it im a beginner, i just made a button stop and made a function stop() where i put inti() but how can i stop it, by above mentioned i get the clearTimeout(t) but what do we store in the variable t? u said we need to store timeout in a variable but timeout is an inuilt funtion i guess... pls help

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

    Radu bhau no.1

  • @subhamjyoti6655
    @subhamjyoti6655 7 месяцев назад +1

    in the elements section container div is not showing any style div

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

      Would be nice if I can have a look at your code (maybe share it on my Discord?)

  • @3mviewsmemes691
    @3mviewsmemes691 Год назад +1

    You are best ;) Thank You !!!!!!!!!!!!!!!!

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

      You're welcome!

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

    loved your content 🎉

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

      Thank you! :-)

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

    nice song

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

      Thank you :-)

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

    Grazie.

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

      Did I just get payed? :-O

  • @Hetvanshigohel
    @Hetvanshigohel 5 месяцев назад +1

    i want to add pause function . and i will add prompt for user input but how to add delay in prompt plzz any one know , tell me

    • @Radu
      @Radu  5 месяцев назад

      I'm not sure what you mean by adding delay in prompt.

    • @Hetvanshigohel
      @Hetvanshigohel 5 месяцев назад +1

      In prompt setTimeOut i want use but there is not work

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

      You might want to share the code with me somehow (like on my discord).

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

    is it possible to develop a code editor like vscode in javascript with syntax highlighting, intelligent code completion features?

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

      Sure it is, like what codepen has. I don't think it has code completion features, but those are possible to add, I'm sure.

  • @kritikabdas5981
    @kritikabdas5981 25 дней назад +1

    Can anyone send me the code for this project I want it in urgent.

    • @Radu
      @Radu  25 дней назад

      It's on my website (linked in the description).

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

    working, thx

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

      You're welcome :-)

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

    You're so good, I'm wondering what it took you like to get to that level of algorithm and programing knowledge. Anyways we appreciate , thank you

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

      Ah, yes, my training. Very well documented here at (1:25) ruclips.net/video/FODkJ0zG0QQ/видео.html

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

      @@Radu hhhhhh, I just saw the video, keep it up, bytheway I really want to master well JavaScript, don't know if there is any suggestion you can give or any help. Thank you

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

      @@gabrielntera5679 :-)) hope you don't take the video seriously. All I can recommend is practice... Work on projects you find interesting so you stay motivated and like what you do.

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

      @@Radu hhhhhh! It's funny yeah, but I've got the message behind. Yeah sure, thank you, and thank you for your reply, bytheway your courses are interesting but also advanced level, I'll try to continue going through them and at and see where I can get. Once again thank you, your channel end teaching skills should be a reference for many

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

      @@gabrielntera5679 Thanks for the nice words. Good luck with your studies!

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

    I am your 900th like!

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

      How so? :-) video has only 149 at the moment.

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

    I love the intro song

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

      Haha, thanks :-)

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

    Dont know why the function call from html(init, play) are not working 😢

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

      Share your code somehow? (Like on my Discord)

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

      @@Radu problem is solved, was using oneclick, insted of onclick 😶.

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

      @@tushar5359 Ah, ok :-)

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

    great video!

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

      Thanks!

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

    Hey on your intro ,its you or your body animation?

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

      It's me... looks weird, or what? :-)

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

    Very good 👍

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

      Thanks!

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

    As for the performance, it would be better to not recreate all bars every time you swap two bars. Better get them by id and change their heights. (This then can also be animated.)

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

      Sure! Thanks for the tip :-)

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

    More videos likes this sir

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

      I'll try :-)

  • @-0-__-0-
    @-0-__-0- Год назад +1

    The video works perfectly with playback speed of 1.5

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

      Cool :-) It's how I watch it as well when I do the editing to save time :-D

    • @-0-__-0-
      @-0-__-0- Год назад

      @@Radu Thanks man. I now have a way to add sound to my own project.

  • @unknown-bx8my
    @unknown-bx8my Год назад +1

    Watch later. I have exams soon.😢

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

      Good luck at the exams :-)

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

    sarcasm.

  • @bowenjing3674
    @bowenjing3674 10 месяцев назад +1

    I was going to subscrib you lol until you singing(joke ....

    • @Radu
      @Radu  10 месяцев назад

      Hope you don't find my other singing videos :-D

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

    Using AI to make the video

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

      No, just some weird camera settings that make it look strange :-P

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

    Fantastic and fun! I'm sharing it! Send loves

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

      Thanks! Glad you liked it.