PHP Класс HTMLPurifier_Queue, yii
We don't use the SPL implementation because it's only supported
on PHP 5.3 and later.
Exercise: Prove that push/pop on this queue take amortized O(1) time.
Exercise: Extend this queue to be a deque, while preserving amortized
O(1) time. Some care must be taken on rebalancing to avoid quadratic
behaviour caused by repeatedly shuffling data from the input stack
to the output stack and back.
Показать файл
Открыть проект
Открытые методы
Метод |
Описание |
|
__construct ( $input = [] ) |
|
|
isEmpty ( ) |
Checks if it's empty. |
|
push ( $x ) |
Pushes an element onto the front of the queue. |
|
shift ( ) |
Shifts an element off the front of the queue. |
|
Описание методов
__construct()
публичный Метод
isEmpty()
публичный Метод
Pushes an element onto the front of the queue.
Shifts an element off the front of the queue.