Bubble sort does not scale well with the addition of new entries in the array to be sorted. This is because the number of operations increases exponentially (of O(n^2)), meaning that for each 1 item added, the number of operations (time to complete) on average increases by n+1^2.

A computer is required to sort data in a database to create indexes for quick retrieval.

  • steps:
    • loop:
      • iterate through each (n) element in unsorted array (ignoring last)
        • compare with the next element (n+1)
          • if it is greater
            • swap the positions of the two
          • if it is lesser
            • do nothing
      • if the previous iteration ^^ required no swaps, end the loop