Bubble Sort
Algorithm Details
Year : 1956
Family : Sorting - Comparison
Authors : NA
Paper Link : NA
Time Complexity :
Problem Statement
Bubble sort is a simple sorting algorithm. This sorting algorithm is comparison-based algorithm in which each pair of adjacent elements is compared and the elements are swapped if they are not in order. This algorithm is not suitable for large data sets as its average and worst case complexity are quadratic where n is the number of items.
PseudoCode
1 begin BubbleSort(list) 2 for all elements of list 3 if list[i] > list[i+1] 4 swap(list[i], list[i+1]) 5 end if 6 end for 7 8 return list 9 10 end BubbleSort
Applications
Bubble sorting is used in programming TV to sort channels based on audience viewing time! Databases use external merge sort to sort sets of data that are too large to be loaded entirely into memory! Sports scores are quickly organized by quick sort algorithm in real-time.
Implementations
Python : https://gist.github.com/j9ac9k/6b5cd12aa9d2e5aa861f942b786293b4
C++ Library : https://github.com/nomemory/neat-matrix-library