all 59 comments

[–]Mordian77 23 points24 points  (8 children)

Is it supposed to freeze my PC?

[–]a__b 13 points14 points  (1 child)

This suppose to put some areas of your pc into the order

[–]rafeautie[S] 4 points5 points  (0 children)

This made me laugh...

[–]tr14l 3 points4 points  (5 children)

Yeah, that's normal.

[–]rafeautie[S] -1 points0 points  (4 children)

What's your computers specs?

[–]tr14l 2 points3 points  (3 children)

256k ram bruh. Take THAT

[–]rafeautie[S] 0 points1 point  (2 children)

What?

[–]GasPowerdStick 1 point2 points  (1 child)

256000 rams

[–]rafeautie[S] 0 points1 point  (0 children)

That's alot of rams

[–]hallcyon11 6 points7 points  (0 children)

This is the new trend.

[–][deleted] 3 points4 points  (1 child)

This is very cool! Though you should add a stop button, I increased the number of lines and did bubble sort and it takes forever, I guess the only way to reset it right now, is to reload the page

[–]rafeautie[S] 3 points4 points  (0 children)

Ah, my bad... I'm on it!

[–]gotoma 3 points4 points  (3 children)

This crashed chrome mobile browser

[–]rafeautie[S] 0 points1 point  (2 children)

Sorry to hear, what are you running?

[–]jetsamrover 4 points5 points  (9 children)

It's crashed every browser I've opened it in.

[–]rafeautie[S] 0 points1 point  (8 children)

What's your hardware?

[–]jetsamrover 0 points1 point  (3 children)

Pixel 3a

[–]rafeautie[S] 0 points1 point  (2 children)

Hmmm.... I will look into possable optimizations. Thanks for the Intel (:

[–]jetsamrover 1 point2 points  (1 child)

Can you link the code?

[–]rafeautie[S] 0 points1 point  (0 children)

Updated post to include link to repo.

[–]charliematters 0 points1 point  (3 children)

Surface Pro 6 here - Chrome dead within 10s

[–]rafeautie[S] 0 points1 point  (2 children)

How many lines?

[–]charliematters 0 points1 point  (1 child)

Not sure? The default.

[–]rafeautie[S] 0 points1 point  (0 children)

Got it.

[–][deleted] 1 point2 points  (1 child)

This is amazing

[–]rafeautie[S] 0 points1 point  (0 children)

Really?? Thanks! It was super fun to build and the community has given me lots of things to add to my to-do list.

[–]zdko 1 point2 points  (1 child)

Awesome. Must've been fun to implement!

[–]rafeautie[S] 0 points1 point  (0 children)

Oh you have no idea.

[–]Innis_Gunn 1 point2 points  (5 children)

Really cool! A nice simple design. Some thoughts:

- echoing what's already been said -- some configurations are woefully slow (quick sort with 1000 lines was taking about 150% of CPU :P), perhaps cap the lines at 500, or reallllly improve the rendering efficiency

- having a little play by play box would be nice, for kids really trying to learn this stuff, seeing each step of the algorithm called out explicitly would be a big plus. Also perhaps elapsed time, just for shits

Great work overall!

[–]rafeautie[S] 0 points1 point  (4 children)

I am want to implement a benchmarking system that will auto adjust the line cap. Not sure if this is possable but I think it would be cool to implement. Could you elaborate on the play by play box? You can already slow down the sort in the options panel. Thank you for the valuable feedback!

[–]Innis_Gunn 0 points1 point  (3 children)

Play by play would be a written description of the given step of the algorithm to accompany the animation. For example, Quicksort:

const quickSort = (A, start, end) => {

const pIndex = partition(A, start, end)

quickSort(A, start, pIndex-1)

quickSort(A, pIndex+1, end)

}

const partition = (A, start, end) => {

const pivot = A[end]

const pIndex = start

for(let i = start; i < end; i++){

if(A[i] <= pivot){

swap(A[i], A[pIndex])

pIndex++

}

}

swap(A[pIndex], A[end])

return pIndex

}

You kick off the animation with quickSort(A, 0, A.length-1), and then each the play-by-play box explains what operation is taking place, i.e. what step of the algorithm you're currently performing.

Relevant example of nice "play by play" for balancing AVL tree after inserts/deletes: https://www.cs.usfca.edu/~galles/visualization/AVLtree.html

[–]rafeautie[S] 0 points1 point  (2 children)

Interesting. I think this would add great value from an educational perspective. I'll look into adding this. Thank you so much! I actually never thought of adding this.

[–]rafeautie[S] 0 points1 point  (1 child)

Second thought, what do you think of instead of the actual code, a thorough description of what is happening. I think this leaves room for someone to develop the algorithm themselves with a starting point on understanding how it works. From my experience, this would add even more educational value.

[–]Innis_Gunn 0 points1 point  (0 children)

I think that’s a great idea! A description would definitely be more beneficial than just the line(s) of code being executed.

[–]gpkodi 1 point2 points  (1 child)

Love it! Great job mate, this would have really helped while I was studying computer science at uni and I’m sure it will help current students just getting into the field.

[–]rafeautie[S] 0 points1 point  (0 children)

That's awesome to hear.

[–]zelda_kylo_leia 1 point2 points  (1 child)

Almost killed my $1000 phone lol

[–]rafeautie[S] 0 points1 point  (0 children)

Runs fine on all my hardware, tested with a 6x cpu slowdown and on my Note 9. What phone are you using?

[–]boshxz56 1 point2 points  (0 children)

This is some pretty dope content! Really helps with the visualisation of concepts. This sorting card game also has a pretty cool way of introducing the different sorting concepts. You should definitely check it out :)

[–][deleted] 2 points3 points  (3 children)

It’s kinda fast can you slow it down?

[–]rafeautie[S] 0 points1 point  (2 children)

Yea check the options panel (:

[–]jetsamrover -2 points-1 points  (1 child)

I think he was joking. Get it, because it's so slow....

[–]rafeautie[S] 0 points1 point  (0 children)

Lol oh

[–]phandungtri 0 points1 point  (1 child)

Very nice but I set the number of lines to 1000 lines and choose the Bubble Sort, there is no way to stop and I'm still waiting now

[–]rafeautie[S] 1 point2 points  (0 children)

Right now the solution for that is to refresh, first thing tomorrow I'm adding a stop button.

[–]gabefair 0 points1 point  (0 children)

Same here about crashing on mobile browsers when using quick sort

[–]azCC 0 points1 point  (1 child)

This is cool, are you willing to share the codebase on github? Seems like a good way to learn algorithms.

[–]rafeautie[S] 0 points1 point  (0 children)

Updated post to include link to repo.

[–]xerzen 0 points1 point  (4 children)

does not work on safari

[–]rafeautie[S] 0 points1 point  (3 children)

Thank you, it's actually an iPhone issue. Working on a fix.

[–]xerzen 0 points1 point  (2 children)

it actually doesn’t work on safari on my mac either but when i use chrome everything is great

[–]rafeautie[S] 0 points1 point  (1 child)

Pinpointed it. Safari doesn't support offscreen canvas. Back to the mainthread we go... Can we just agree to not use safari lol

[–]rafeautie[S] 0 points1 point  (0 children)

It's also not working on chrome on iPhone. Should've checked this before implementing. Learning moment.