In this activity, we will explore the functionality of the Bubble Sort algorithm, one of the simplest yet fundamental sorting methods in computer science. The goal of Bubble Sort is to sort a list of elements by comparing adjacent element pairs and swapping them if they are in the wrong order.
The Bubble Sort algorithm compares and swaps consecutive elements in multiple passes through the list until all elements are sorted.
Implement the Bubble Sort algorithm in a programming language of your choice. Below is an example implementation in C++: