diff options
author | Patrick Simianer <p@simianer.de> | 2014-02-12 18:35:49 +0100 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2014-02-12 18:35:49 +0100 |
commit | 7d298cd7f165c0d46e34825f300c0cb83012dae5 (patch) | |
tree | 2b7f4b22368983e174b51cbbfc1e6c4f665d0be1 /lib/nlp_ruby | |
parent | 1d06f4042c0ebdfc7a12880e78e0610f22c321aa (diff) |
fix DAGS::dijkstra
Diffstat (limited to 'lib/nlp_ruby')
-rw-r--r-- | lib/nlp_ruby/PriorityQueue.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/nlp_ruby/PriorityQueue.rb b/lib/nlp_ruby/PriorityQueue.rb index 22662b3..f090e60 100644 --- a/lib/nlp_ruby/PriorityQueue.rb +++ b/lib/nlp_ruby/PriorityQueue.rb @@ -5,6 +5,7 @@ class PriorityQueue def initialize a=Array.new @queue = Array.new a + sort! end def sort! @@ -12,12 +13,12 @@ class PriorityQueue end def pop - sort! @queue.pop end def push i @queue << i + sort! end def empty? |