Bubble Sort

Easy
Problem Statement

Bubble sort is a simple sorting algorithm that repeatedly steps through the list, compares adjacent elements and swaps them if they are in the wrong order.

Constraints

  • In-place sorting algorithm
  • Time Complexity: O(N²)
  • Space Complexity: O(1)
  • N = number of elements
Solution