ScratchData LogoScratchData
Back to jsbwalker's profile

Stack Sort Visualization

JSjsbwalker•Created March 8, 2015
Stack Sort Visualization
11
8
417 views
View on Scratch

Instructions

[Press the spacebar to begin sorting]

Description

Original Text: "I was playing around with a deck of cards when I came up with an idea for a sorting algorithm that used four lists. This is an implementation of that algorithm in scratch." This is a handy little visualization for my Stack Sort algorithm. Rendering these bars isn't speeding up the sorting process so this isn't sorting things optimally. I should also add this program is hardly optimized. I would like to actually have another crack at writing it because of how lackluster it is. Normally this algorithm can sort 10000 random elements in 1.5ish seconds, which is rather impressive for scratch. You can see the unaltered program here: http://scratch.mit.edu/projects/24548542/ (Just remember to hide the lists for maximum performance) Here's an explanation of what exactly is going on here. This algorithm is a kind of merge sort that instead of working with the data directly by switching elements in a list, pops and pushes the numbers between one of four lists. The first thing that the algorithm does is it distributes the data evenly between the first two stacks and assumes that there are groups of sorted data in these lists of size one. It will the pop data off of each of the filled lists and push it onto another to try to make groups of 2, then 4,8,16 and so on. This is done until all of the data is in one list.

Project Details

Project ID51292650
CreatedMarch 8, 2015
Last ModifiedNovember 2, 2015
SharedMarch 8, 2015
Visibilityvisible
CommentsAllowed