by solving a problem, and carefully observe every step that you take.
think of sorting a numbers 8 6 4 7 from low to high. oh i'll just move 4 to the first one. think why you pick 4 ? because its the smallest, how do you know its the smallest ? because you see the other number and 4 is the smallest by comparison. so if you retrace the step
1. compare every number until the smallest one found
2. pick that number
3. put it in the front
see ? thats the algorithm. and guess what thore are part of algorithm called Selection Sort.
just look closer on how you solve a problem with logic.