Skip to content

Latest commit

 

History

History
30 lines (14 loc) · 880 Bytes

File metadata and controls

30 lines (14 loc) · 880 Bytes

Selection Sort

Select i and j starts from i+1, pick the minimum element while completing the j loop, and then swap it with i, then again continue like this

"Select the minimum element, then swap with i"

Bubble Sort

Heaviest Element pulled towards the end.

outer loop starts from the end, inner j loop from 0 to i-1

Insertion sort

we maintain a sorted left array as we move forward, so for i we gonna start from there and go till index 0 (j), make sure that this subarray array is sorted.

continue until we reach the end, that means from end to index 0, the whole array becomes sorted.

Bucket Sort

Consider the frequency as index.

make a map that stores elements and its frequencies

then a vector/ list of list that stores the elements, based on frequency as index and list as the elements that have frequency == that array index

ABSOLUTE CINEMA!