Just to point out, your algorithm presented doesn't actually bubble making it much slower. In a bubble sort we guarantee that one element bubbles to the end of the list. We never need to consider it again. So while that bubbling will happen to the array elements in your code, we never get the benefit of it.
Just to point out, your algorithm presented doesn't actually bubble making it much slower. In a bubble sort we guarantee that one element bubbles to the end of the list. We never need to consider it again. So while that bubbling will happen to the array elements in your code, we never get the benefit of it.