Assignments
Assignments should be completed from top to bottom as they will raise in difficulty the lower in the stack.
- Assignment - Selection Sort
- Read about Selection Sort in Grokking Algorithms (Chapter 2)
- Watch this video on Selection Sort
- Now:
- Create your own diagram of how Selection Sort works for a list of length 4, like we have been in class. Put this diagram in the
README.mdfile of the GitHub repo you will create for this assignment. - Write your own implementation of Selection Sort in Python.
- Write pytest tests for it:
- Test for a list of length 0 of randomly ordered integers (such as
[]) - Tests for a list of length 1 of randomly ordered integers (such as
[3])- Write tests specifically for
0, a positive integer, and a negative integer
- Write tests specifically for
- Tests for a list of length 4 of randomly ordered integers (such as
[-4, 0, 1, -9])- Make sure your data includes
0and a negative integer
- Make sure your data includes
- Each test should do two things:
- Test that the list has been correctly sorted
- Your program must have a print statement for each "step" of the sorting algorithm. The test should look at this output to check that your algorithm is behaving correctly
- Test for a list of length 0 of randomly ordered integers (such as
- Create your own diagram of how Selection Sort works for a list of length 4, like we have been in class. Put this diagram in the