Apply bubble sort algorithm (#736)

Apply bubble sort algorithm (#736)

Repeatedly swap adjacent elements if out of order.