Caleb Hearth
March 31, 2017
1.1k

# Sorting Rubyists

We'll visualize the steps for several sorting algorithms not only using pretty visualizations on a slide, but also with people as the objects being sorted. Don't know what an algorithm is, what performance really means, or what "Big O" means, or what these best-, worst-, and average-case time complexities mean? No problem! We're going to learn together how computers figure out how to sort sets of numbers. You can expect to come out knowing new things and with Benny Hill stuck in your head.

We'll visualize several sorting algorithms---but we'll be sorting the audience! Don't know what an algorithm is, what performance means, what "Big O" is, or the effect best-, worst-, and average-case time complexities? No problem: we'll learn together! You can expect to come out knowing new things and with Benny Hill stuck in your head.

Source code and notes: https://calebhearth.com/talks/sorting-rubyists

March 31, 2017

## Transcript

12. ### 0 2 4 6 8 10 0 1 2 3

4 5 6 7 8 9 10 O(n) n
13. ### 0 2 4 6 8 10 0 1 2 3

4 5 6 7 8 9 10 O (log n )
14. ### 0 250 500 750 1000 1 4 7 10 13

16 19 22 25 28 31 34 37 40 43 46 49 52 55 58 61 64 67 70 73 76 79 82 85 88 91 94 97 100 O(n) O(1) O(log n) O(n log n) O(n^2) O(2^n) O(n!)
15. ### 0 25 50 75 100 1 4 7 10 13

16 19 22 25 28 31 34 37 40 43 46 49 52 55 58 61 64 67 70 73 76 79 82 85 88 91 94 97 100 O(n) O(1) O(log n) O(n log n) O(n^2) O(2^n) O(n!)

log n )

)

116. ### 0 250 500 750 1000 1 4 7 10 13

16 19 22 25 28 31 34 37 40 43 46 49 52 55 58 61 64 67 70 73 76 79 82 85 88 91 94 97 100 O(n) O(1) O(log n) O(n log n) O(n^2) O(2^n) O(n!)

215. ### Bibliography • Pollice, G., Selkow, S., Heineman, G.T. (2008). Algorithms

in a Nutshell. O’Reilly Media, Inc. • Bhargava, A. (2016). Grokking Algorithms. Manning Publications. • du Sautoy, M. (Presenter), Overton, P. (Producer). (2015, September 24). The Secret Rules of Modern Living: Algorithms [Television broadcast]. London, UK: BBC Four. • Yukihiro, M. (1996). Array.sort!. Ruby [Software]. Retrieved 2017, March 27 from https://github.com/ruby/ruby/blob/ 47563655037ed453607de33b86fcc094878769ac/ array.c#L2431-L2513.