队列和循环队列-php数组
3 月,跳不动了?>>> //实现基本队列 class Queues { private $head; private $tail; private $cnt; //数组大小 private $array = []; public function __construct($n = 5) { $this->cnt = $n; $this->head = 0; $this->tail = 0; } //数组实现队列 public function basisEnQueue($val) { //队列已满 if ($this->tail == $this->cnt) { return false; } $this->array[$this->tail] = $val; $this->tail++; return true; } //出队列 public function basisDelQueue() { //队列为空 if ($this->head == $this->tail) { return false; } $ret = $this->array[$this->head]; unset($this->array[$this->head]); $this->head++; return $ret; } //队列迁移 使用已删除空间 public function