Best Case for Bubble Sort
algorithm, bubble-sort
Solution
Best case scenario is one pass. The list would already be sorted. No swap = done.
Problem
I want to know what will be the best case for a bubble sort ? There may be a case wherein there may be no swapping for the say last 2 passes for example. I'm doing my program in C language. Suppose i have an array of 5 elements and i give the elements as 1 2 5 4 3 then there would be no change in the last 2 passes?