Loading [MathJax]/jax/output/HTML-CSS/fonts/TeX/fontdata.js

 

Looking at the Slection Sort we can define two nested loops:
1. First loop: iterating once over the whole array (8 elements)
2. Second loop: Iterating over the whole loop for each element out of the 8 of the first loop (decresing by 1 for each first loop progress).

example:
for( i = 0 ; i < arr.length ; i++){
   //each time the i loop progresses by one, the j loop is shorter since it begins the loop one element higher.
    (for j = i; j < arr.length; j++){
         
   }
}

 

This means: If we want to sort n items, we have to loop n times, inside of which we loop n times, which gives us roughly a fun time of n*n or n^2 , which is considered very ineficient.

This relationship of input size to the number of steps the al7