老生常谈PHP中的数据结构:DS扩展(2)

Ds\Stack implements Ds\Collection { /* 方法 */ public void allocate ( int $capacity ) public int capacity ( void ) public void clear ( void ) public Ds\Stack copy ( void ) public bool isEmpty ( void ) public mixed peek ( void ) public mixed pop ( void ) public void push ([ mixed $...values ] ) public array toArray ( void ) }

Queue Class:“first in, first out”集合,只允许在结构前端进行访问和迭代。

Ds\Queue implements Ds\Collection { /* Constants */ const int MIN_CAPACITY = 8 ; /* 方法 */ public void allocate ( int $capacity ) public int capacity ( void ) public void clear ( void ) public Ds\Queue copy ( void ) public bool isEmpty ( void ) public mixed peek ( void ) public mixed pop ( void ) public void push ([ mixed $...values ] ) public array toArray ( void ) }

PriorityQueue Class:优先级队列与队列是非常相似的,但值以指定的优先级被推入队列,优先级最高的值总是位于队列的前面,同优先级元素“先入先出”顺序任然保留。在一个PriorityQueue上递代是具有破坏性的,相当于连续弹出操作直到队列为空。Implemented using a max heap.

Ds\PriorityQueue implements Ds\Collection { /* Constants */ const int MIN_CAPACITY = 8 ; /* 方法 */ public void allocate ( int $capacity ) public int capacity ( void ) public void clear ( void ) public Ds\PriorityQueue copy ( void ) public bool isEmpty ( void ) public mixed peek ( void ) public mixed pop ( void ) public void push ( mixed $value , int $priority ) public array toArray ( void ) }

以上这篇老生常谈PHP中的数据结构:DS扩展就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持脚本之家。

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/84b8000dc1376bfc36e159b287d4a49b.html