Created
March 23, 2016 10:28
-
-
Save alherd-by/6060ac68391f1d7ef0f9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'HastTable.php'; | |
const LENGTH = 20; | |
$hs1 = generate(); | |
var_dump($hs1); | |
$hs1->bucketSort(); | |
var_dump($hs1); | |
echo str_repeat('=', 150) . PHP_EOL; | |
echo str_repeat('=', 150) . PHP_EOL; | |
echo str_repeat('=', 150) . PHP_EOL; | |
$hs2 = generate(); | |
var_dump($hs2); | |
$hs2->selectionSort(); | |
var_dump($hs2); | |
function generate(){ | |
$division = function ($key) { | |
return $key % LENGTH; | |
}; | |
$hastTableDiv = new HastTable($division); | |
for ($i = 0; $i < LENGTH; $i++) { | |
$key = random_int(1000000000000, 9999999999999); | |
$hastTableDiv[$key] = random_int(-100, 100); | |
} | |
return $hastTableDiv; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment