Implementation of bubblesort algorithm