首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

SplPriorityQueue (class)

Introduction

(PHP 5 >= 5.3.0, PHP 7)

The SplPriorityQueue class provides the main functionalities of a prioritized queue, implemented using a max heap.

Class synopsis

SplPriorityQueue implements Iterator , Countable {

/* Methods */

public __construct ( void )

代码语言:javascript
复制
public int compare ( mixed $priority1 , mixed $priority2 )
代码语言:javascript
复制
public int count ( void )
代码语言:javascript
复制
public mixed current ( void )
代码语言:javascript
复制
public mixed extract ( void )
代码语言:javascript
复制
public void insert ( mixed $value , mixed $priority )
代码语言:javascript
复制
public bool isEmpty ( void )
代码语言:javascript
复制
public mixed key ( void )
代码语言:javascript
复制
public void next ( void )
代码语言:javascript
复制
public void recoverFromCorruption ( void )
代码语言:javascript
复制
public void rewind ( void )
代码语言:javascript
复制
public void setExtractFlags ( int $flags )
代码语言:javascript
复制
public mixed top ( void )
代码语言:javascript
复制
public bool valid ( void )

}

Table of Contents

  • SplPriorityQueue::__construct — Constructs a new empty queue
  • SplPriorityQueue::count — Counts the number of elements in the queue.
  • SplPriorityQueue::current — Return current node pointed by the iterator
  • SplPriorityQueue::extract — Extracts a node from top of the heap and shift up.
  • SplPriorityQueue::insert — Inserts an element in the queue by sifting it up.
  • SplPriorityQueue::isEmpty — Checks whether the queue is empty.
  • SplPriorityQueue::key — Return current node index
  • SplPriorityQueue::recoverFromCorruption — Recover from the corrupted state and allow further actions on the queue.
  • SplPriorityQueue::rewind — Rewind iterator back to the start (no-op)
  • SplPriorityQueue::setExtractFlags — Sets the mode of extraction
  • SplPriorityQueue::valid — Check whether the queue contains more nodes
代码语言:txt
复制
 ? 1997–2017 The PHP Documentation Group

Licensed under the Creative Commons Attribution License v3.0 or later.

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com