I have an array of 5 elements. On that i want to apply bubble sort with min complexity
Currently what i am doing is
function bubbleSort(array $arr)
{
$n = sizeof($arr);
for ($i = 1; $i < $n; $i++) {
for ($j = $n - 1; $j >= $i; $j--) {
//some fuzzy logic here
}
}
}
Any help ?