summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Simianer <simianer@cl.uni-heidelberg.de>2014-02-13 12:51:57 +0100
committerPatrick Simianer <simianer@cl.uni-heidelberg.de>2014-02-13 12:51:57 +0100
commitbd9d9cbe8252d4d32b0c414009b85267fffae1ce (patch)
tree35739bf700739f96152ba075579ac6981ecb7c33
parent7c213980b509bce9cbbf727ee920ced8be9b6b68 (diff)
parent7d298cd7f165c0d46e34825f300c0cb83012dae5 (diff)
Merge branch 'master' of github.com:pks/nlp_ruby
-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?