-
Notifications
You must be signed in to change notification settings - Fork 0
/
SortClass_handler.php
64 lines (62 loc) · 2.39 KB
/
SortClass_handler.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Sort array</title>
<link rel="stylesheet" href="assets/reset.css">
<link href="assets/css/bootstrap.min.css" rel="stylesheet" media="screen">
</head>
<body>
<script src="assets/jquery-3.2.1.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<?php
/**
* Created by PhpStorm.
* User: dobrodeev
* Date: 10.08.2018
* Time: 22:00
*/
spl_autoload_register(function ($className) {
include $className . '.php';
});
//include 'sorts.php';
$objectSort = new SortClass();
//$objectSort->our_sort();
$countElements = 900;
echo '<span style="color: #005cbf">После сортировки ' . $countElements . ' элементов массива: </span><br>';
//$objectSort->print_arr();
$array = $objectSort->randomArray($countElements);
/*echo '<pre>';
print_r($array);
echo '</pre>';*/
$mtime = microtime(true);
$objectSort->bubbleSort($array);
printf("Время операции сортировки bubbletSort() <span style='color: #007bff'>%f милисекунд. </span>", microtime(true) - $mtime);
echo 'microtime(): ' . microtime(true) . '<br>';
//$objectSort->print_arr($array);
shuffle($array);
$mtime = microtime(true);
$objectSort->caseSort($array);
printf("Время операции сортировки caseSort() <span style='color: #007bff'>%f милисекунд. </span>", microtime(true) - $mtime);
echo 'microtime(): ' . microtime(true) . '<br>';
shuffle($array);
$mtime = microtime(true);
$objectSort->insertSort($array);
printf("Время операции сортировки insertSort() <span style='color: #007bff'>%f милисекунд. </span>", microtime(true) - $mtime);
echo 'microtime(): ' . microtime(true) . '<br>';
shuffle($array);
$mtime = microtime(true);
$objectSort->qsort($array, 0, count($array) - 1);
printf("Время операции сортировки quickSort() <span style='color: #007bff'>%f милисекунд. </span>", microtime(true) - $mtime);
echo 'microtime(): ' . microtime(true) . '<br>';
//$objectSort->print_arr($array);
//$objectSort->caseSort($array);
//$objectSort->insertSort($array);
//$objectSort->insertSort()
//$objectSort->print_arr($array);
?>
</body>
</html>