Difference between revisions of "Bubble Sort Design"

From AgentCubes
Jump to navigation Jump to search
imported>Andri
imported>Andri
Line 8: Line 8:
  
 
== Explorations ==
 
== Explorations ==
<change>
+
* Run the "1D Bubbles" world to see how numbers are sorted in a single dimension. Bubbles are sorted according to a single value. Step the simulation to see the sorting step by step. Or use a slower speed on the animation slider.
* Run the "Unsorted Color Strings" worksheet to see step by step how numbers are sorted. Press space to speed the process up
+
* Run the "2D Bubbles" world for two-dimensional sorting: the bubbles are sorted according to two values, Red and Green.
* Run the "2D Bubbles" worksheet for more complex sorting
+
* Run the "3D Bubbles" world for three-dimensional sorting: the bubbles are sorted according to three values, Red, Green, and Blue. Sorting takes place in multiple layers.
* Move pieces while the sort is running
+
* Use the "2D Bubbles 2500" for sorting a large number of bubbles
* Run the "4 block" worksheet. Add more V-H-Bubble agents while the sort is running and see them be sorted on the fly
+
* Run the "2D partial sorts". Once the two separate clusters are sorted, select the 2D bubble in the Agents list and make pathways to connect the two clusters, while the simulation is still running.
* Stop and swap the extreeme color pieces and then step through to see how they walk back
 
</change>
 
 
* Be the bubble! Select a bubble and go into first-person camera mode and play the simulation. Make sure the speed slider is not at the fastest setting so you can see the animation. You can then watch the sorting take place from the perspective of a bubble.
 
* Be the bubble! Select a bubble and go into first-person camera mode and play the simulation. Make sure the speed slider is not at the fastest setting so you can see the animation. You can then watch the sorting take place from the perspective of a bubble.
* Change the swap criteria ">" with "<" while running
 
 
   
 
   
 
   
 
   

Revision as of 00:25, 22 August 2011

Bubble Sort.png

This project is an implementation of one-, two- and three- dimensional Bubble Sort. Bubble sort is a simple sort algoritym in which adjacent numbers (represented as colors) get swapped if they are in the wrong order. AgentCubes is used in this case to visualize how the algorithm works. Please note that there is no centralized control in this implementation. Every bubble at each moment in time is ready to swap itself. A simple generalization of this approach leads to the 2D version of bubble sort in which numbers bubble horizontaly as well as vertically.

Category

  • Computer Science


Explorations

  • Run the "1D Bubbles" world to see how numbers are sorted in a single dimension. Bubbles are sorted according to a single value. Step the simulation to see the sorting step by step. Or use a slower speed on the animation slider.
  • Run the "2D Bubbles" world for two-dimensional sorting: the bubbles are sorted according to two values, Red and Green.
  • Run the "3D Bubbles" world for three-dimensional sorting: the bubbles are sorted according to three values, Red, Green, and Blue. Sorting takes place in multiple layers.
  • Use the "2D Bubbles 2500" for sorting a large number of bubbles
  • Run the "2D partial sorts". Once the two separate clusters are sorted, select the 2D bubble in the Agents list and make pathways to connect the two clusters, while the simulation is still running.
  • Be the bubble! Select a bubble and go into first-person camera mode and play the simulation. Make sure the speed slider is not at the fastest setting so you can see the animation. You can then watch the sorting take place from the perspective of a bubble.


Acknowledgements