Selection Sort algorithm in depth with C++
To represent this sorting algorithm we can visualize an array of unsorted integers. From there we start by marking the first integer and calling it Small . All the other numbers in the array will then be to the right of Small . We will then compare Small with all the other integers to the right. Checking if they are less than Small , and if so, we will be replacing the variable Small with the lowest value found. Let's imagine we have a array of integers 7, 8, 5, 4, 9, 2. In that case Small will be equal to 7 (Being the blue arrow). Now let's compare Small with the numbers to the right (The yellow arrow). Checking if they are in fact less than Small . So with the example above, we will first be checking if 8 < 7 . If that's true, then we will have to switch Small = 7 with Small = 8 . In this case, that simply isn't true. So we will have to move on with comparing Small = 7 with the other integers in the list. For the next step we can see that 5 wil...