2082 5

CSC325 ยท 2082 ยท 5 marks

Find the best and worst case for Bubble sort.

Find the best and worst case for Bubble sort. [5]

Design and Analysis of AlgorithmsChapter 2: Iterative AlgorithmsSorting Algorithms

Bubble sort is the simplest sorting algorithm that works by repeatedly swapping adjacent elements if they are in the wrong order. A list with n elements requires n-1 passes for sorting. In each pass, element a[i] is compared with a[i+1] and swapped if they are not in proper order. --- --- The bes...