summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2014-02-12 18:35:49 +0100
committerPatrick Simianer <p@simianer.de>2014-02-12 18:35:49 +0100
commit7d298cd7f165c0d46e34825f300c0cb83012dae5 (patch)
tree2b7f4b22368983e174b51cbbfc1e6c4f665d0be1 /lib
parent1d06f4042c0ebdfc7a12880e78e0610f22c321aa (diff)
fix DAGS::dijkstra
Diffstat (limited to 'lib')
-rw-r--r--lib/nlp_ruby/PriorityQueue.rb3
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?