-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from geocrystal/priority-queue
use priority queue
- Loading branch information
Showing
4 changed files
with
39 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,11 @@ description: | | |
authors: | ||
- Anton Maminov <[email protected]> | ||
|
||
dependencies: | ||
priority-queue: | ||
github: spider-gazelle/priority-queue | ||
branch: master | ||
|
||
development_dependencies: | ||
ameba: | ||
github: crystal-ameba/ameba | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
require "priority-queue" | ||
|
||
module Priority | ||
class Item(V) | ||
def initialize(@priority : Float64, @value : V, name = nil) | ||
@name = name.to_s if name | ||
end | ||
end | ||
|
||
class Queue(V) | ||
def push(priority : Float64, value : V, name = nil) | ||
item = Item(V).new(priority, value, name) | ||
push(item) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters