Giter Club home page Giter Club logo

fibonacciheap's Introduction

NPM

WARNING: This module is now deprecated. Please replace with @tyriar/fibonacci-heap

Algorithm clear decreaseKey delete extractMinimum findMinimum insert isEmpty size union
Fibonacci heap Θ(1)* Θ(1)* O(log n)* O(log n)* Θ(1) Θ(1) Θ(1) Θ(n) Θ(1)

* amortised

Installation

$ npm install fibonacciheap

Methods

clear()

Clears the heap's data, making it an empty heap.

decreaseKey(node, newKey)

node: Node, the node to be decreased

newKey: number, the new key value

delete(node)

node: Node, the node to remove from the heap

extractMinimum()

Returns

Node, the node with the smallest key

findMinimum()

Returns

Node, the node with the smallest key

insert(key, value)

key: number,

value: object, any value associated with the node to insert

Returns

Node, the node that was inserted

isEmpty()

Returns

boolean, true if the heap is empty

size()  

Returns

number, the amount of nodes in the heap

union(other)

other: FibonacciHeap, the FibonacciHeap to union with this one

compare(a, b)  

a: Node, a node to compare

b: Node, a node to compare

Returns

number, 1 if a has a larger key than b, -1 if b has a larger key than a and 0 if they are equal

Running Tests

Install the development dependencies:

$ npm install

Then run the tests:

$ npm test

Code Coverage

Install the development dependencies:

$ npm install

Then run coverage

$ npm run coverage

View coverage reports

$ firefox coverage/lcov-report/index.html

Browser Bundle

$ npm run build

fibonacciheap's People

Contributors

tyriar avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.