Bubble sort, Selection sort implementations