<?php
//Дам массив чисел, отсортируйте по возрастанию без использования стандартной функции sort( ) и подобных. на JS/PHP.
//Функция использует алгоритм сортировки выбором
$numbers = array(1, 2, 3, 4, 5, 22, 12, 12, 123, 52, 24, 1302, -1);
{
return $result;
}
$min = $array[$keys[0]];
$minKey = $keys[0];
foreach ($array as $key => $number) {
if ($number < $min) {
$min = $number;
$minKey = $key;
}
}
$result[] = $min;
return mySort($array, $result);
}
PD9waHAKLy/QlNCw0Lwg0LzQsNGB0YHQuNCyINGH0LjRgdC10LssINC+0YLRgdC+0YDRgtC40YDRg9C50YLQtSDQv9C+INCy0L7Qt9GA0LDRgdGC0LDQvdC40Y4g0LHQtdC3INC40YHQv9C+0LvRjNC30L7QstCw0L3QuNGPINGB0YLQsNC90LTQsNGA0YLQvdC+0Lkg0YTRg9C90LrRhtC40Lggc29ydCggKSDQuCDQv9C+0LTQvtCx0L3Ri9GFLiDQvdCwIEpTL1BIUC4KLy/QpNGD0L3QutGG0LjRjyDQuNGB0L/QvtC70YzQt9GD0LXRgiDQsNC70LPQvtGA0LjRgtC8INGB0L7RgNGC0LjRgNC+0LLQutC4INCy0YvQsdC+0YDQvtC8CiRudW1iZXJzID0gYXJyYXkoMSwgMiwgMywgNCwgNSwgMjIsIDEyLCAxMiwgMTIzLCA1MiwgMjQsIDEzMDIsIC0xKTsKCmZ1bmN0aW9uIG15U29ydChhcnJheSAkYXJyYXksIGFycmF5ICRyZXN1bHQgPSBhcnJheSgpKQp7CiAgICBpZiAoZW1wdHkoJGFycmF5KSkgewogICAgICAgIHJldHVybiAkcmVzdWx0OwogICAgfQoKICAgICRrZXlzID0gYXJyYXlfa2V5cygkYXJyYXkpOwogICAgJG1pbiA9ICRhcnJheVska2V5c1swXV07CiAgICAkbWluS2V5ID0gJGtleXNbMF07CiAgICBmb3JlYWNoICgkYXJyYXkgYXMgJGtleSA9PiAkbnVtYmVyKSB7CiAgICAgICAgaWYgKCRudW1iZXIgPCAkbWluKSB7CiAgICAgICAgICAgICRtaW4gPSAkbnVtYmVyOwogICAgICAgICAgICAkbWluS2V5ID0gJGtleTsKICAgICAgICB9CiAgICB9CiAgICB1bnNldCgkYXJyYXlbJG1pbktleV0pOwogICAgJHJlc3VsdFtdID0gJG1pbjsKICAgIHJldHVybiBteVNvcnQoJGFycmF5LCAkcmVzdWx0KTsKfQoKcHJpbnRfcihteVNvcnQoJG51bWJlcnMpKTs=