00:01
This question asks us to animate selection sort.
00:04
We start with 20 distinct numbers in a random order, display them as a histogram, and every time the user clicks step, the program performs one pass of the outer loop.
00:13
The main idea of selection sort is during each pass, we find the smallest number in the unsorted part and move it into its correct position.
00:25
So we need to keep track of where the sorted part ends.
00:28
A variable like self .i can mark the first.
00:31
Unsorted position.
00:36
When the user click step, the program should search the index i to the end of the list, find the smallest value and swap it with the value at index i.
00:53
For j in range, self .i plus one, then self dot values, if self dot values, bracket j less than self dot values bracket min index, min index equals j.
01:34
Self.
01:35
Values bracket self.
01:37
I comma, self...