Find the bug in the code snippet below and fix it. Explain what this code does and what the O() ("Big Oh" notation) is.
for ($i=0,$j=count($list);$i<$j; ++$i) {
for ($n=0,$m=count($list);$n<$m;++$n) {
if ($list[$n]>$list[$n+1]) {
$tmp=$list[$i];
$list[$n]=$list[$n+1];
$list[$n+1]=$tmp;
}
}
}
array(5) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
[3]=>
int(4)
[4]=>
int(5)
}
1