From 7d298cd7f165c0d46e34825f300c0cb83012dae5 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Wed, 12 Feb 2014 18:35:49 +0100 Subject: fix DAGS::dijkstra --- lib/nlp_ruby/PriorityQueue.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') 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? -- cgit v1.2.3