Skip to content

thread safe priority queue implementation in pure Ruby

License

Notifications You must be signed in to change notification settings

kiuKisas/th_prim_queue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Thread safe Priority Queue

A thread safe priority queue implementation in pure Ruby which tends to mimic the original ruby queue in use.

Complexity

It use a binary search to order the queue, so the complexity increases about O(log(n)) at every push.

Usage

initialize(elems=nil, &block)

initialize takes two optionals parameters:

  • elems that you can store in queue, it must be an array
  • a lambda which will be use to sort the queue. By default, it sort by descendant order like this: lambda { |a,b| a >= b }

For the rest, it's rather the same as ruby queue.

To Do

  • tests

License

This code is under Beer-Ware Licence, you can see LICENCE.md for more information.

About

thread safe priority queue implementation in pure Ruby

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages