All Projects → theodesp → go-heaps

theodesp / go-heaps

Licence: MIT License
Reference implementations of heap data structures in Go - treap, skew, leftlist, pairing, fibonacci

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to go-heaps

jheaps
Master repository for the JHeaps project
Stars: ✭ 34 (-56.96%)
Mutual labels:  pairing-heap, fibonacci-heap
py-algorithms
Algorithms and Data Structures, solutions to common CS problems.
Stars: ✭ 26 (-67.09%)
Mutual labels:  heaps, fibonacci-heap
treap
A thread-safe, persistent Treap (tree + heap) for ordered key-value mapping and priority sorting.
Stars: ✭ 23 (-70.89%)
Mutual labels:  treap
InterviewBit
Collection of solution for problems on InterviewBit
Stars: ✭ 77 (-2.53%)
Mutual labels:  heaps
Pony
Haxe open-cross-library
Stars: ✭ 88 (+11.39%)
Mutual labels:  heaps
hlimgui
No description or website provided.
Stars: ✭ 28 (-64.56%)
Mutual labels:  heaps
treap
🍃 🌳 🍂 Efficient implementation of the implicit treap data structure
Stars: ✭ 64 (-18.99%)
Mutual labels:  treap
js-data-structures
🌿 Data structures for JavaScript
Stars: ✭ 56 (-29.11%)
Mutual labels:  heaps
algoexpert
AlgoExpert is an online platform that helps software engineers to prepare for coding and technical interviews.
Stars: ✭ 8 (-89.87%)
Mutual labels:  heaps
Problem-Solving
This Repository consists of my solutions💡 in Python 3 to various problems in Data Structures and Algorithms.🎖️
Stars: ✭ 17 (-78.48%)
Mutual labels:  heaps
Binarytree
Python Library for Studying Binary Trees
Stars: ✭ 1,694 (+2044.3%)
Mutual labels:  heaps
C Sharp Algorithms
📚 📈 Plug-and-play class-library project of standard Data Structures and Algorithms in C#
Stars: ✭ 4,684 (+5829.11%)
Mutual labels:  heaps

go-heaps All Contributors

GoDoc License

Reference implementations of heap data structures in Go

Installation

$ go get -u github.com/theodesp/go-heaps

Contents

Heaps

  • Pairing Heap: A pairing heap is a type of heap data structure with relatively simple implementation and excellent practical amortized performance.
  • Leftist Heap: a variant of a binary heap. Every node has an s-value which is the distance to the nearest leaf. In contrast to a binary heap, a leftist tree attempts to be very unbalanced.
  • Skew Heap: A skew heap (or self-adjusting heap) is a heap data structure implemented as a binary tree. Skew heaps are advantageous because of their ability to merge more quickly than binary heaps.
  • Fibonacci Heap: a Fibonacci heap is a data structure for priority queue operations, consisting of a collection of heap-ordered trees. It has a better amortized running time than many other priority queue data structures including the binary heap and binomial heap.
  • Binomial Heap: A Binomial Heap is a collection of Binomial Trees. A Binomial Heap is a set of Binomial Trees where each Binomial Tree follows Min Heap property. And there can be at most one Binomial Tree of any degree.
  • Treap Heap: A Treap and the randomized binary search tree are two closely related forms of binary search tree data structures that maintain a dynamic set of ordered keys and allow binary searches among the keys.
  • Rank Pairing Heap: A heap (priority queue) implementation that combines the asymptotic efficiency of Fibonacci heaps with much of the simplicity of pairing heaps

Usage

package main

import (
	"github.com/theodesp/go-heaps"
	pairingHeap "github.com/theodesp/go-heaps/pairing"
	"fmt"
)

func main()  {
	heap := pairingHeap.New()
	heap.Insert(go_heaps.Integer(4))
	heap.Insert(go_heaps.Integer(3))
	heap.Insert(go_heaps.Integer(2))
	heap.Insert(go_heaps.Integer(5))

	fmt.Println(heap.DeleteMin()) // 2
	fmt.Println(heap.DeleteMin()) // 3
	fmt.Println(heap.DeleteMin()) // 4
	fmt.Println(heap.DeleteMin()) // 5
}

Complexity

Operation Pairing Leftist Skew Fibonacci Binomial Treap
FindMin Θ(1) Θ(1) Θ(1) Θ(1) Θ(log n) O(n)
DeleteMin O(log n) O(log n) O(log n) O(log n) Θ(log n) O(n)
Insert Θ(1) O(log n) O(log n) Θ(1) Θ(1) O(n)
Find O(n)
Delete O(n) O(log n) O(n) Θ(log n) O(n)
Adjust O(n) O(log n) O(n) Θ(log n) O(n)
Meld Θ(1)
Operation Rank Pairing
FindMin Θ(1)
DeleteMin O(log n)
Insert Θ(1)
Find O(n)
Delete O(n)
Adjust O(n)
Meld Θ(1)

Contributors

Thanks goes to these wonderful people (emoji key):

Miroojin Bakshi
Miroojin Bakshi

💻
Syfaro
Syfaro

💻
Theofanis Despoudis
Theofanis Despoudis

💻
Radliński Ignacy
Radliński Ignacy

💻
Don McNamara
Don McNamara

🚇
Afrizal Fikri
Afrizal Fikri

💻
Logan HAUSPIE
Logan HAUSPIE

💻
Song Guo
Song Guo

💻
Safwan Mohammed
Safwan Mohammed

⚠️ 💻

This project follows the all-contributors specification. Contributions of any kind welcome!

LICENCE

Copyright © 2017 Theo Despoudis MIT license

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].