PHP Class 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.
Exibir arquivo
Open project: yiisoft/yii
Public Methods
Method |
Description |
|
__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. |
|
Method Details
__construct()
public method
Pushes an element onto the front of the queue.
Shifts an element off the front of the queue.