Playing around with visualizing sorting algorithms in WPF
Saw these images from a HN post, and I thought it was really interesting. So I thought I would give it a try myself, and quickly pieced together a WPF app. Most of the algorithms I found were in Stackoverflow or some tech articles. WPF is probably not ideal/optimal for animation, but it was quick to put together.
- Insertion Sort - 1
- Insertion Sort - 2
- Insertion Sort - Spiral - 1
- Insertion Sort - Spiral - 2
- Quicksort
- Heapsort
- Clean code so it's easier to add new sort algorithms
- Find a faster / more efficient way to draw bitmaps (Look into WriteableBitmap)
- Play around with the pixels ordinal value (top to bottom and left to right), (spiral order?)
Currently this is how the pixels are ordered.
0 1 2 3 4
5 6 7 8 9
10 11 12 13 14
15 16 17 18 19
Starting from the outside, and working inwards. Ordering the pixels in this way should give an interesting animation.
0 1 2 3 4
13 14 15 16 5
12 19 18 17 6
11 10 9 8 7