Solution: Arrange a Binary List
In this review lesson, we give a detailed analysis of how to sort a binary list.
We'll cover the following...
We'll cover the following...
Solution #1: bubble sort
Explanation
The most obvious solution to this problem is the bubble sort algorithm. All the elements in the list are either zeros or ones. Sorting the elements in an ascending order with the help of the bubble sort algorithm will shift all the zeros towards the left and all the ones towards the right.
Time complexity
...