00:01
Here we're doing the selection sort algorithm in pseudocode.
00:05
And the selection sort algorithm finds the smallest element in the list, or least element, and kind of moves it to the front.
00:18
Then the least element of the remaining list is found and moved to the second position, and so on and so forth.
00:27
And so what we need for this algorithm is able to, list of natural numbers here and long and in order for there to be a least element so let's say natural for the natural numbers uh but for there to be a least element we need at least two elements in the list okay and so we're going to start here by iterating sort of through every index right so let's say for i as it runs from index one to n and we'll we're doing this because we need to find the least element in the list.
01:17
So we'll start by initializing the minimum to sort of the first element of the remaining the chunk of list that we are working with.
01:35
Okay, then we're going to iterate again.
01:46
This time we want to iterate through one element up to the end of the list.
02:00
And this is so we can find our least element.
02:05
And so what we want to do is want to compare.
02:10
So what's happening is if we have a list of numbers and say the first couple already sorted, say the first one has been sorted.
02:19
And so we're at the second number.
02:21
We're going to set that to be the minimum.
02:23
And then we're going to compare the rest to it to see if any of them are smaller.
02:29
Okay...