I sort of figured out how to do this on my own. Basically for each item minus the last one, starting from the first one, you compare that item with the next one. If it's greater than that one, then swap them. If not, let it be there. You repeat that for total items you have minus one, because doing the comparing for the last one is redundant.