Meet Goals by KeepSolid 3.0!
Get the updated version now for half the price
Also meet the new Google Calendar integration

Bubble Sort

Bubble sort is a basic sorting algorithm that arranges a string of elements by repeatedly comparing and swapping adjacent elements until all elements are in the correct order.

This approach examines each pair of adjacent elements from left to right, checking if they are in the correct - ascending or descending - order, and switches their positions if the order is wrong. Afterwards, the algorithm repeats this process until it reaches the end of the string and finds no pair of elements that are out of order.

Learn the definition of Bubble Sort

Algorithm

The high-level algorithm can be described, as follows:

begin BubbleSort(list)

   for all elements of list

   if list[i] > list[i+1]

      swap(list[i], list[i+1])

   end if

   end for

   return list

end BubbleSort

where the list is an array of elements, and the swap function is responsible for swapping the elements that are out of order.

When to use

In Computer and Data Science, the bubble sort is considered to be a beginner algorithm and an inefficient and wasteful sorting method, because it swaps items before it achieves the final result, which is quite costly. Therefore, it cannot handle large and significantly unsorted data sets. However, it can handle even large pools of data which are already semi-sorted, such as lists of students from different years that are enrolled in a variety of courses. In this case, students are semi-sorted age-wise, which makes the sorting inexpensive. 

At the same time, the bubble sort is capable of doing what other algorithms cannot do: since it goes through the whole unsorted part of the list, it can recognize when the list is sorted and stop. This is a big advantage when the list requires just a few passes. 

Finally, the algorithm is easy to understand even for nontechnical people, and it is simple to write, because it takes just a dozen lines of code.

Bubble sort in product management

Because the bubble sort method is simple and efficient with smaller data sets, it is quite useful in product management when there is a need to weigh competing work directions or to order and prioritize the product backlog.

At a higher level, product managers can weigh the costs and benefits of backlog entries and decide which of them will be included in the product roadmap. Then each backlog item is assigned story points to reflect the amount of time and effort required to complete this task. Yet, after all estimation and scoring is done, the Product Backlog needs to be prioritized. This is a kind of simple sorting, where the bubble sort technique works the best: the top two items are compared against their priorities and complexity (story points) and interchanged if the order is incorrect. Then you address the next pair and keep going through the whole list of backlog entries until the backlog seems ordered. In this case, prioritization and sorting are two sides of one process.

It is one of the major product manager’s and product owner’s responsibilities to decide on where to focus the team’s resources, and in this case, the bubble sort algorithm is a useful tool that makes the priorities more visible and the backlog ranking objective and free from omissions.

Stay on top of Business Goals

Set Goals, Plan Strategy, Involve Your Team, and Achieve Big Results. Manage the future with our Leading Goal Management Software

All rights reserved