<?php
function sorted($a){
return $a;
} else {
foreach ($a as $v){
if ($v < $med)
$l[] = $v;
else
$r[] = $v;
}
}
}
$a = array(11,1,23,45,7,12,4,6,8,43); $a = sorted($a);
PD9waHAKCWZ1bmN0aW9uIHNvcnRlZCgkYSl7CgkJaWYoY291bnQoJGEpPDIpewoJCQlyZXR1cm4gJGE7CgkJfSBlbHNlIHsKCQkJJGwgPSBhcnJheSgpOwoJCQkkciA9IGFycmF5KCk7CgkJCSRtZWQgPSAkYVtyb3VuZCgoY291bnQoJGEpLTEpLzIpXTsKCQkJCgkJCWZvcmVhY2ggKCRhIGFzICR2KXsKCQkJCWlmICgkdiA8ICRtZWQpCgkJCQkJJGxbXSA9ICR2OwoJCQkJZWxzZQoJCQkJCSRyW10gPSAkdjsKCQkJfQoJCQkKCQkJcmV0dXJuIGFycmF5X21lcmdlKHNvcnRlZCgkbCksIHNvcnRlZCgkcikpOwkKCQl9Cgl9CgkKCSRhID0gYXJyYXkoMTEsMSwyMyw0NSw3LDEyLDQsNiw4LDQzKTsKCSRhID0gc29ydGVkKCRhKTsKCXByaW50X3IoJGEpOw==