PHP Classes
elePHPant
Icontem

File: qstest.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Allan Bogh  >  Enhanced QuickSort  >  qstest.php  >  Download  
File: qstest.php
Role: Example script
Content type: text/plain
Description: Example/test file for the Quick Sort class
Class: Enhanced QuickSort
Sort array of comparable values with quicksort
Author: By
Last change:
Date: 8 years ago
Size: 722 bytes
 

Contents

Class file image Download
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>

<body>

<?php
include('includes/classes/quicksort.php');

srand(time());
$random = array();

//best if used for 10000 items or less.
for($i = 0; $i < 5000; $i++){
   
$random[] = (rand()%9);
}

$qs = new QuickSort($random);
unset(
$random);

$time1 = time();
$qs->sortArray();
$time2 = time();
$sorted = $qs->getSortedArray();

echo
"Maximum Ex Time: ".($time2-$time1)."ms<br><br>";

//foreach($sorted as $value){
// echo $value." ";
//}
?>
</body>
</html>