Skip to content

Commit b814cf2

Browse files
fix some ci warnings
1 parent 5817388 commit b814cf2

File tree

4 files changed

+110
-26
lines changed

4 files changed

+110
-26
lines changed

Graphs/BreadthFirstSearch.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?php
22

33
/**
4-
* Breadth-first search (BFS) is an algorithm for searching a tree data structure for a node that satisfies a given property.
4+
* Breadth-first search (BFS) is an algorithm for searching a tree data structure for a node that satisfies
5+
* a given property.
56
* (https://en.wikipedia.org/wiki/Breadth-first_search).
67
*
78
* This is a non-recursive implementation.

Searches/ExponentialSearch.php

+16-19
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,32 @@
88
**** if it were in the list.
99
* In the second stage, a binary search is performed on this range.
1010
*/
11-
/**
12-
* @param Array $arr
13-
* @param int $value
14-
* @param int $floor
15-
* @param int $ceiling
16-
* @return int
17-
**/
11+
12+
/**
13+
* @param Array $arr
14+
* @param int $value
15+
* @param int $floor
16+
* @param int $ceiling
17+
* @return int
18+
**/
1819
function binarySearch($arr, $value, $floor, $ceiling)
1920
{
20-
21-
// Get $middle index
21+
// Get $middle index
2222
$mid = floor(($floor + $ceiling) / 2);
2323
// Return position if $value is at the $mid position
2424
if ($arr[$mid] === $value) {
2525
return (int) $mid;
2626
}
27-
//Return -1 is range is wrong
27+
//Return -1 is range is wrong
2828
if ($floor > $ceiling) {
2929
return -1;
3030
}
31-
// search the left part of the $array
32-
// If the $middle element is greater than the $value
31+
32+
// search the left part of the $array
33+
// If the $middle element is greater than the $value
3334
if ($arr[$mid] > $value) {
3435
return binarySearch($arr, $value, $floor, $mid - 1);
35-
}
36-
// search the right part of the $array
37-
// If the $middle element is lower than the $value
38-
else {
36+
} else { // search the right part of the $array If the $middle element is lower than the $value
3937
return binarySearch($arr, $value, $mid + 1, $ceiling);
4038
}
4139
}
@@ -47,13 +45,12 @@ function binarySearch($arr, $value, $floor, $ceiling)
4745
*/
4846
function exponentialSearch($arr, $value)
4947
{
50-
51-
// If $value is the first element of the $array return this position
48+
// If $value is the first element of the $array return this position
5249
if ($arr[0] === $value) {
5350
return 0;
5451
}
5552

56-
// Find range for binary search
53+
// Find range for binary search
5754
$i = 1;
5855
$length = count($arr);
5956
while ($i < $length && $arr[$i] <= $value) {

tests/Ciphers/CiphersTest.php

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
22

3-
use function PHPUnit\Framework\assertEquals;
4-
53
use PHPUnit\Framework\TestCase;
64

75
require_once __DIR__ . '/../../vendor/autoload.php';

0 commit comments

Comments
 (0)