Beispiel #1
0
function randomTest($N, $k)
{
    $es = array();
    $a = array();
    for ($i = 0; $i < $k; $i++) {
        $a[$i] = rand(0, $N);
    }
    $t1 = microtime(true);
    $q = new QuickSort($a);
    $q->sort();
    return array('time' => microtime(true) - $t1, 'swaps' => $q->getSwaps(), 'compares' => $q->getCompares());
}
Beispiel #2
0
 /**
  * @test
  */
 public function testGetSwaps()
 {
     $a = array(10, 10);
     $q = new QuickSort($a);
     $q->getSwaps();
 }