Design an algorithm to sort a given list.

[4, 1, 6, 5, 2]
user
A sorting algorithm for the given list can use the following steps:
1. Compare the first two elements and swap them if the first element is greater than the second element.
2. Continue doing the same with the next two elements until the end of the list is reached.
3. Repeat steps 1 and 2 until the list is in sorted order.
The sorted list would be: [1, 2, 4, 5, 6].
assistant