bubblesort: use for instead of while