philiprehberger-priority_queue 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/README.md +15 -41
- data/lib/philiprehberger/priority_queue/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b6c6189abf62a5cd7a03eec4626b908cfb8fbfd954e8183dbb5ebe43f421105f
|
|
4
|
+
data.tar.gz: 8af43691f143f9c673f56fed46d90486d9e0616ca938939bd99e5e62262b0bb9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fbb8db631237032ac270c43fe2c5a1f9e9c33a906a4e2c60def195451ade5d930196ffdaf44cd3342d21228a870c98d493ff31764fe0f7587e488b74a82003e7
|
|
7
|
+
data.tar.gz: 12603ff8ef9d42bbac4fb3f364dab1b6edda0904962752e5ada257a022ec060f801d27175a7954c0849a2bd7499d78d9899d2a578bd6b1019ad26a32761a95cc
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,17 @@ and this gem adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.1.7] - 2026-03-24
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- Standardize README code examples to use double-quote require statements
|
|
14
|
+
|
|
15
|
+
## [0.1.6] - 2026-03-24
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
- Standardize README API section to table format
|
|
19
|
+
- Fix Installation section quote style to double quotes
|
|
20
|
+
|
|
10
21
|
## [0.1.5] - 2026-03-23
|
|
11
22
|
|
|
12
23
|
### Fixed
|
data/README.md
CHANGED
|
@@ -15,7 +15,7 @@ Binary heap priority queue with min/max modes, custom comparators, and priority
|
|
|
15
15
|
Add to your Gemfile:
|
|
16
16
|
|
|
17
17
|
```ruby
|
|
18
|
-
gem
|
|
18
|
+
gem "philiprehberger-priority_queue"
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
Or install directly:
|
|
@@ -27,7 +27,7 @@ gem install philiprehberger-priority_queue
|
|
|
27
27
|
## Usage
|
|
28
28
|
|
|
29
29
|
```ruby
|
|
30
|
-
require
|
|
30
|
+
require "philiprehberger/priority_queue"
|
|
31
31
|
|
|
32
32
|
# Min-heap (default) - lowest priority first
|
|
33
33
|
queue = Philiprehberger::PriorityQueue::Queue.new
|
|
@@ -74,45 +74,19 @@ queue.clear # removes all items
|
|
|
74
74
|
|
|
75
75
|
## API
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
Returns the highest-priority item without removing it. Returns `nil` if empty.
|
|
92
|
-
|
|
93
|
-
### `#size` / `#empty?`
|
|
94
|
-
|
|
95
|
-
Returns the number of items or whether the queue is empty.
|
|
96
|
-
|
|
97
|
-
### `#change_priority(item, new_priority)`
|
|
98
|
-
|
|
99
|
-
Updates the priority of an existing item and re-heapifies. Raises `ArgumentError` if the item is not found.
|
|
100
|
-
|
|
101
|
-
### `#to_a`
|
|
102
|
-
|
|
103
|
-
Returns all items sorted by priority.
|
|
104
|
-
|
|
105
|
-
### `#include?(item)`
|
|
106
|
-
|
|
107
|
-
Returns `true` if the item is in the queue.
|
|
108
|
-
|
|
109
|
-
### `#clear`
|
|
110
|
-
|
|
111
|
-
Removes all items from the queue.
|
|
112
|
-
|
|
113
|
-
### `#merge(other)`
|
|
114
|
-
|
|
115
|
-
Returns a new queue containing items from both queues. Does not modify the originals.
|
|
77
|
+
| Method | Description |
|
|
78
|
+
|--------|-------------|
|
|
79
|
+
| `Queue.new(mode: :min, &comparator)` | Create a priority queue; mode can be `:min` or `:max`; optional custom comparator block |
|
|
80
|
+
| `#push(item, priority:)` | Add an item with the given priority |
|
|
81
|
+
| `#pop` | Remove and return the highest-priority item |
|
|
82
|
+
| `#peek` | Return the highest-priority item without removing it |
|
|
83
|
+
| `#size` | Return the number of items in the queue |
|
|
84
|
+
| `#empty?` | Return `true` if the queue has no items |
|
|
85
|
+
| `#change_priority(item, new_priority)` | Update the priority of an existing item and re-heapify |
|
|
86
|
+
| `#to_a` | Return all items sorted by priority |
|
|
87
|
+
| `#include?(item)` | Return `true` if the item is in the queue |
|
|
88
|
+
| `#clear` | Remove all items from the queue |
|
|
89
|
+
| `#merge(other)` | Return a new queue containing items from both queues |
|
|
116
90
|
|
|
117
91
|
## Development
|
|
118
92
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: philiprehberger-priority_queue
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- philiprehberger
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-03-
|
|
11
|
+
date: 2026-03-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: A binary heap-based priority queue supporting min-heap, max-heap, and
|
|
14
14
|
custom comparator modes. Features O(log n) push/pop, priority changes, merge operations,
|