Abstract Priority Queue

It implements a priority queue. Please go to "Data Structures and Algorithms", Aho, Hopcroft, and Ullman, Addison-Wesley, 1983 (corrected 1987 edition), for implementation details.

It provides O(log(N)) time of put/pop operations, where N is a size of queue

category Zend
package Zend_Search_Lucene
subpackage Index
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License
inherited_from \Zend_Search_Lucene_PriorityQueue

 Methods

Clear queue

clear() 
Inherited

Removes and return least element of the queue

pop() : mixed
Inherited

O(log(N)) time

Returns

mixed

Add element to the queue

put(mixed $element) 
Inherited

O(log(N)) time

Parameters

$element

mixed

Return least element of the queue

top() : mixed
Inherited

Constant time

Returns

mixed

Compare elements

_less(mixed $termsStream1, mixed $termsStream2) : boolean

Returns true, if $termsStream1 is "less" than $termsStream2; else otherwise

inherited_from \Zend_Search_Lucene_PriorityQueue::_less()

Parameters

$termsStream1

mixed

$termsStream2

mixed

Returns

boolean

Compare elements

_less(mixed $el1, mixed $el2) : boolean
Inherited

Returns true, if $el1 is less than $el2; else otherwise

Parameters

$el1

mixed

$el2

mixed

Returns

boolean

 Properties

 

Queue heap

$_heap : array

Default

array()

Heap contains balanced partial ordered binary tree represented in array [0] - top of the tree [1] - first child of [0] [2] - second child of [0] ... [2n + 1] - first child of [n] [2n + 2] - second child of [n]