mirror of
https://github.com/Xevion/processing-projects.git
synced 2025-12-06 01:15:57 -06:00
cocktail shaker sort sketch
This commit is contained in:
@@ -6,4 +6,6 @@ Sketches that visualize sorting algorithms as they progress.
|
|||||||
|
|
||||||
## Sketches
|
## Sketches
|
||||||
|
|
||||||
- **cocktail_shaker_line** - Sorting of a line using the cocktail shaker algorithm (double bouble sort I believe). Needs reworking as the colors and movement of the line is not as expected (colors shift, movement doesn't properly correlate).
|
- **cocktail_shaker_line** - Sorting of a line using the cocktail shaker algorithm (double bouble sort I believe). Needs reworking as the colors and movement of the line is not as expected (colors shift, movement doesn't properly correlate).
|
||||||
|
|
||||||
|
- **insertion_sort_line** - Sorting of a line using the insertion sort algorithm.
|
||||||
8
sorting/insertion_sort_line/insertion_sort_line.pyde
Normal file
8
sorting/insertion_sort_line/insertion_sort_line.pyde
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
def setup():
|
||||||
|
|
||||||
|
def draw():
|
||||||
|
if unsorted:
|
||||||
|
get = unsorted.pop(0)
|
||||||
|
for index, num in enumerate(sorted):
|
||||||
|
if sorted[index] < sorted[index + 1] and sorted[index + 1] >= get:
|
||||||
|
sorted.append(
|
||||||
2
sorting/insertion_sort_line/sketch.properties
Normal file
2
sorting/insertion_sort_line/sketch.properties
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
mode=Python
|
||||||
|
mode.id=jycessing.mode.PythonMode
|
||||||
Reference in New Issue
Block a user