This file contains 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 | |
/** | |
* A data type that computes the suffix array of a string | |
*/ | |
class SuffixArray | |
{ | |
/** | |
* Text | |
* @var string |
This file contains 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 | |
class Queens | |
{ | |
/** | |
* Board size | |
* @var integer | |
*/ | |
protected $boardSize; |
This file contains 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 | |
class UnionFind | |
{ | |
/** | |
* Elements | |
* @var array | |
*/ | |
public $elements; |
This file contains 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 | |
$input = [ | |
1, | |
2, | |
3, | |
4, | |
5, | |
6, | |
7 |
This file contains 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 | |
/** | |
* Selection sort | |
* | |
* @param array $input | |
* @return array | |
*/ | |
function selectionSort(array $input) | |
{ |
This file contains 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 | |
class Stack | |
{ | |
/** | |
* Items | |
* | |
* @var array | |
*/ | |
protected $items = []; |
This file contains 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 | |
class Queue | |
{ | |
/** | |
* Items | |
* | |
* @var array | |
*/ | |
protected $items = []; |
This file contains 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 | |
/** | |
* Insertion sort | |
* | |
* @param array $input | |
* @return array | |
*/ | |
function insertionSort(array $input) | |
{ |
This file contains 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 | |
$input = [ | |
1, | |
3, | |
5, | |
2, | |
4, | |
6, | |
8, |
This file contains 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 | |
function getTime($hour, $minute) | |
{ | |
$hour = (int) $hour; | |
$minute = (int) $minute; | |
// start time again | |
if ($hour == 12 && $minute > 30) { | |
$hour = 0; |
OlderNewer