초기 체섭 릴리즈로 업로드

This commit is contained in:
2018-01-31 19:10:04 +09:00
parent cfbdaecd03
commit d7a3116784
490 changed files with 141072 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
<?
class Queue {
private $capacity;
private $size;
private $head;
private $tail;
private $arr;
function Queue($capacity) {
$this->capacity = $capacity;
$this->size = 0;
$this->head = 0;
$this->tail = 0;
}
function getSize() {
return $this->size;
}
function clear() {
$this->size = 0;
$this->head = 0;
$this->tail = 0;
}
function push($value) {
if($this->size >= $this->capacity) return;
$this->arr[$this->tail] = $value;
$this->tail = ($this->tail + 1) % $this->capacity;
$this->size++;
}
function pop() {
if($this->size <= 0) return null;
$value = $this->arr[$this->head];
$this->head = ($this->head + 1) % $this->capacity;
$this->size--;
return $value;
}
}
?>