Bubble sort algorithm


Bubble sort (or sinking sort) is a simple sorting algorithm that repeatedly steps through a list, compares adjacent elements, and swaps them if they are in the wrong order. Write code that implements a bubble sort algorithm. Your algorithm should be written as a function and take in an array as a parameter.


Access restricted

Subscribe to premium account to see the solution.

Get premium now