In Class: Week 9 Wednesday
If you have not already done so, create a week09 subdirectory in your
cs21/class directory:
% cd
% cd cs21/class
% pwd
/home/your_user_name/cs21/class
% mkdir week09
Then, from within your week09 subdirectory copy over some python files
from my public directory:
% cd week09
% pwd
/home/your_user_name/cs21/class/week09
% cp ~newhall/public/cs21/week09/* .
% ls
- binarysearch.py is the implementation of binary searching algorithm
that we did in class on Monday.
- we are going to add a function, selectionSort, that takes a list
of values and sorts them using the selection sort algorithm:
- step 1: find bucket with the smallest value in the list, swap
its value with the value in bucket 0
- step 2: find the next smallest value in the list, swap it with
bucket 1
- step 3: find the next smallest value in the list, swap it with
bucket 2
- ...
- last step: the last bucket contains the largest value