Copyright (c) 2015, Emir Pasic. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Package binaryheap implements a binary heap backed by array list. Comparator defines this heap as either min or max heap. Structure is not thread safe. References: http://en.wikipedia.org/wiki/Binary_heap
Pop removes top element on heap and returns it, or nil if heap is empty. Second return parameter is true, unless the heap was empty and there was nothing to pop.
Peek returns top element on the heap without removing it, or nil if heap is empty. Second return parameter is true, unless the heap was empty and there was nothing to peek.
Performs the "bubble down" operation. This is to place the element that is at the root of the heap in its correct place so that the heap maintains the min/max-heap order property.
Performs the "bubble down" operation. This is to place the element that is at the index of the heap in its correct place so that the heap maintains the min/max-heap order property.
Performs the "bubble up" operation. This is to place a newly inserted element (i.e. last element in the list) in its correct place so that the heap maintains the min/max-heap order property.
The pages are generated with Goldsv0.3.2-preview. (GOOS=darwin GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.