1.64k likes | 1.75k Views
Teacher Talk 2011. There has never been a better time to teach Computer Science We can learn from Chemistry, Physics, Biology, …. What am I going to show you?. First, I will use sorting to demonstrate “This is the best time to teach CS”.
E N D
Teacher Talk 2011
There has never been a better time to teach Computer Science • We can learn from Chemistry, Physics, Biology, …
What am I going to show you? First, I will use sorting to demonstrate “This is the best time to teach CS” Second, I will use binary trees (and AVL trees) to show we can do what Chemists do
Sorting, what’s that then? Given a collection of data, get it into order …
Sorting, what’s that then? Given a collection of data, get it into order … 9 2 6 0 4 3 2 7 5 This is NOT in order
Sorting, what’s that then? Given a collection of data, get it into order … 0 2 3 4 5 6 7 9 This is IS in order
Sorting, what’s that then? Given a collection of data, get it into order … 0 2 3 4 5 6 7 9 This is IS in order It’s in ascending order
Sorting, what’s that then? Sorting is the process of going from this 9 2 6 0 4 3 2 7 5 to that 0 2 3 4 5 6 7 9
Who cares? Sorting, why bother? 9 2 6 0 4 3 2 7 5 You can find things quicker!
Who cares? Sorting, why bother? 9 2 6 0 4 3 2 7 5 You can find things quicker! 0 2 3 4 5 6 7 9 Use “binary search” (or even linear search and stop early)
Who cares? Sorting, why bother? Do you remember the telephone directory? Imagine if it was just in any order (random) How long would it take you to find my telephone number?
Who cares? Sorting, why bother? Do you remember the telephone directory? Imagine if it was just in any order (random) How long would it take you to find my telephone number? Do you remember the dictionary? Imagine if that was just in any order. How long would it take to find a word, or to determine if the word was not present?
Who cares? Sorting, why bother? Do you remember the telephone directory? Imagine if it was just in any order (random) How long would it take you to find my telephone number? Do you remember the dictionary? Imagine if that was just in any order. How long would it take to find a word, or to determine if the word was not present? Do you ever use an online spelling checker? How does that work?
Who cares? Sorting, why bother?
Who cares? Sorting, why bother? What do you prefer?
sorting • Some algorithms for sorting • bubble sort • insertion sort • selection sort • shell sort • gnome sort • merge sort • quick sort • heap sort • radix sort • bead sort
sorting What’s an algorithm? • Some algorithmsfor sorting • bubble sort • insertion sort • selection sort • shell sort • gnome sort • merge sort • quick sort • heap sort • radix sort • bead sort
sorting • Some algorithms for sorting • bubble sort • insertion sort • selection sort • shell sort • gnome sort • merge sort • quick sort • heap sort • radix sort • bead sort quadratic
sorting • Some algorithms for sorting • bubble sort • insertion sort • selection sort • shell sort • gnome sort • merge sort • quick sort • heap sort • radix sort • bead sort logarithmic
sorting • Some algorithms for sorting • bubble sort • insertion sort • selection sort • shell sort • gnome sort • merge sort • quick sort • heap sort • radix sort • bead sort linear
sorting • Some algorithms for sorting • bubble sort • insertion sort • selection sort • shell sort • gnome sort • merge sort • quick sort • heap sort • radix sort • bead sort Our example
Quadratic algorithms • bubble sort • insertion sort • selection sort Example sorting 9 2 6 0 4 3 2 7 5 Bubble Sort
Quadratic algorithms • bubble sort • insertion sort • selection sort Example sorting 9 2 6 0 4 3 2 7 5 compare Bubble Sort
Quadratic algorithms • bubble sort • insertion sort • selection sort Example sorting 2 9 6 0 4 3 2 7 5 swap Bubble Sort
Quadratic algorithms • bubble sort • insertion sort • selection sort Example sorting 2 9 6 0 4 3 2 7 5 compare Bubble Sort
Quadratic algorithms • bubble sort • insertion sort • selection sort Example sorting 2 6 9 0 4 3 2 7 5 swap Bubble Sort
Quadratic algorithms • bubble sort • insertion sort • selection sort Example sorting 2 6 9 0 4 3 2 7 5 compare Bubble Sort
Quadratic algorithms • bubble sort • insertion sort • selection sort Example sorting 2 6 0 9 4 3 2 7 5 swap Bubble Sort
Quadratic algorithms • bubble sort • insertion sort • selection sort Example sorting 2 6 0 9 4 3 2 7 5 compare Bubble Sort
Quadratic algorithms • bubble sort • insertion sort • selection sort Example sorting 2 6 0 4 9 3 2 7 5 swap Bubble Sort
Quadratic algorithms • bubble sort • insertion sort • selection sort Example sorting 2 6 0 4 9 3 2 7 5 compare Bubble Sort
Quadratic algorithms • bubble sort • insertion sort • selection sort Example sorting 2 6 0 4 3 9 2 7 5 swap Bubble Sort
Quadratic algorithms • bubble sort • insertion sort • selection sort Example sorting 2 6 0 4 3 9 2 7 5 compare Bubble Sort
Quadratic algorithms • bubble sort • insertion sort • selection sort Example sorting 2 6 0 4 3 2 9 7 5 swap Bubble Sort
Quadratic algorithms • bubble sort • insertion sort • selection sort Example sorting 2 6 0 4 3 2 9 7 5 compare Bubble Sort
Quadratic algorithms • bubble sort • insertion sort • selection sort Example sorting 2 6 0 4 3 2 7 9 5 swap Bubble Sort
Quadratic algorithms • bubble sort • insertion sort • selection sort Example sorting 2 6 0 4 3 2 7 9 5 compare Bubble Sort
Quadratic algorithms • bubble sort • insertion sort • selection sort Example sorting 2 6 0 4 3 2 7 5 9 swap Bubble Sort
Quadratic algorithms • bubble sort • insertion sort • selection sort Example sorting 2 6 0 4 3 2 7 5 9 Bubble Sort
Quadratic algorithms • bubble sort • insertion sort • selection sort Example sorting 2 6 0 4 3 2 7 5 9 compare Bubble Sort
Quadratic algorithms • bubble sort • insertion sort • selection sort Example sorting 2 6 0 4 3 2 7 5 9 compare Bubble Sort
Quadratic algorithms • bubble sort • insertion sort • selection sort Example sorting 2 0 6 4 3 2 7 5 9 swap Bubble Sort
Quadratic algorithms • bubble sort • insertion sort • selection sort Example sorting 2 0 6 4 3 2 7 5 9 compare Bubble Sort
Quadratic algorithms • bubble sort • insertion sort • selection sort Example sorting 2 0 4 6 3 2 7 5 9 swap Bubble Sort
Quadratic algorithms • bubble sort • insertion sort • selection sort Example sorting 2 0 4 6 3 2 7 5 9 compare Bubble Sort
Quadratic algorithms • bubble sort • insertion sort • selection sort Example sorting 2 0 4 3 6 2 7 5 9 swap Bubble Sort