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

SplHeap (class)

Introduction

(PHP 5 >= 5.3.0, PHP 7)

The SplHeap class provides the main functionalities of a Heap.

Class synopsis

abstract SplHeap implements Iterator , Countable {

/* Methods */

public __construct ( void )

代码语言:javascript
复制
abstract protected int compare ( mixed $value1 , mixed $value2 )
代码语言:javascript
复制
public int count ( void )
代码语言:javascript
复制
public mixed current ( void )
代码语言:javascript
复制
public mixed extract ( void )
代码语言:javascript
复制
public void insert ( mixed $value )
代码语言: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 mixed top ( void )
代码语言:javascript
复制
public bool valid ( void )

}

Table of Contents

  • SplHeap::compare — Compare elements in order to place them correctly in the heap while sifting up.
  • SplHeap::__construct — Constructs a new empty heap
  • SplHeap::count — Counts the number of elements in the heap.
  • SplHeap::current — Return current node pointed by the iterator
  • SplHeap::extract — Extracts a node from top of the heap and sift up.
  • SplHeap::insert — Inserts an element in the heap by sifting it up.
  • SplHeap::isEmpty — Checks whether the heap is empty.
  • SplHeap::key — Return current node index
  • SplHeap::recoverFromCorruption — Recover from the corrupted state and allow further actions on the heap.
  • SplHeap::rewind — Rewind iterator back to the start (no-op)
  • SplHeap::valid — Check whether the heap contains more nodes

← SplQueue::setIteratorMode

代码语言:txt
复制
 ? 1997–2017 The PHP Documentation Group

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

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com