evansenter / f_heap Goto Github PK
View Code? Open in Web Editor NEWhttp://en.wikipedia.org/wiki/Fibonacci_heap
License: MIT License
http://en.wikipedia.org/wiki/Fibonacci_heap
License: MIT License
FHeap ===== This is an implementation of the Fibonacci Heap data structure in Ruby. The Fibonacci Heap is a collection of trees that satisfy the minimum heap property (that is to say, each child node has a value >= its parent's value), which elicits the trait of having a better amortized runtime than a binomial heap. Example ======= irb(main):002:0> heap = FHeap.new => #<FHeap:0x10164d0c8 @trees=[], @min_node=nil> irb(main):003:0> heap.insert!(9) irb(main):004:0> heap.insert!(7) irb(main):005:0> heap.insert!(8) irb(main):006:0> heap.insert!(6) irb(main):007:0> heap.insert!(5) irb(main):008:0> heap.insert!(3) irb(main):009:0> heap.insert!(4) irb(main):010:0> heap.insert!(2) irb(main):011:0> heap.insert!(1) irb(main):012:0> heap.insert!(0) irb(main):013:0> heap.extract_minimum!.value => 0 irb(main):014:0> heap.extract_minimum!.value => 1 irb(main):015:0> heap.extract_minimum!.value => 2 irb(main):016:0> heap.extract_minimum!.value => 3 irb(main):017:0> heap.extract_minimum!.value => 4 irb(main):018:0> heap.extract_minimum!.value => 5 irb(main):019:0> heap.extract_minimum!.value => 6 irb(main):020:0> heap.extract_minimum!.value => 7 irb(main):021:0> heap.extract_minimum!.value => 8 irb(main):022:0> heap.extract_minimum!.value => 9 irb(main):023:0> heap.extract_minimum! => nil Copyright (c) 2010 Evan Senter, released under the MIT license
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.