philiprehberger-priority_queue 0.1.4 → 0.1.6
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 +14 -1
- data/README.md +23 -47
- data/lib/philiprehberger/priority_queue/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7527c4ccc3db4ec7cd3f63e45ad84f7f1fa4724436f099cb7f68269dd0f21510
|
|
4
|
+
data.tar.gz: 395a2885bc1fc84d675bd6bba4387dddaaff5bd2979745c62f5c9ecec8441299
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f85b7772d196465f5e3569f67347a6e98d204e31c2d1c9207da474a270820aad208f36acd04b60bfcdbbe4052d445769a39d48f588eacf24a025802413c00438
|
|
7
|
+
data.tar.gz: 4169e41b5cfcbd1070f0bd360e57ca3898b04896b7db4356bf64bbdaa01969695f88f5114d7f1ed121fdce89d2e13ec3313e0c59c85d8b128dad997cd47cbaca
|
data/CHANGELOG.md
CHANGED
|
@@ -6,7 +6,20 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
|
6
6
|
and this gem adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
## [0.1.6] - 2026-03-24
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- Standardize README API section to table format
|
|
14
|
+
- Fix Installation section quote style to double quotes
|
|
15
|
+
|
|
16
|
+
## [0.1.5] - 2026-03-23
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
- Standardize README to match template (installation order, code fences, license section, one-liner format)
|
|
20
|
+
- Update gemspec summary to match README description
|
|
21
|
+
|
|
22
|
+
## [0.1.4] - 2026-03-22
|
|
10
23
|
|
|
11
24
|
### Changed
|
|
12
25
|
- Fix README badges to match template (Tests, Gem Version, License)
|
data/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
[](https://rubygems.org/gems/philiprehberger-priority_queue)
|
|
5
5
|
[](LICENSE)
|
|
6
6
|
|
|
7
|
-
Binary heap priority queue with min/max modes
|
|
7
|
+
Binary heap priority queue with min/max modes, custom comparators, and priority updates
|
|
8
8
|
|
|
9
9
|
## Requirements
|
|
10
10
|
|
|
@@ -12,14 +12,16 @@ Binary heap priority queue with min/max modes and custom comparators. Features O
|
|
|
12
12
|
|
|
13
13
|
## Installation
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
Add to your Gemfile:
|
|
16
|
+
|
|
17
|
+
```ruby
|
|
18
|
+
gem "philiprehberger-priority_queue"
|
|
17
19
|
```
|
|
18
20
|
|
|
19
|
-
Or
|
|
21
|
+
Or install directly:
|
|
20
22
|
|
|
21
|
-
```
|
|
22
|
-
gem
|
|
23
|
+
```bash
|
|
24
|
+
gem install philiprehberger-priority_queue
|
|
23
25
|
```
|
|
24
26
|
|
|
25
27
|
## Usage
|
|
@@ -72,49 +74,23 @@ queue.clear # removes all items
|
|
|
72
74
|
|
|
73
75
|
## API
|
|
74
76
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
Returns the highest-priority item without removing it. Returns `nil` if empty.
|
|
90
|
-
|
|
91
|
-
### `#size` / `#empty?`
|
|
92
|
-
|
|
93
|
-
Returns the number of items or whether the queue is empty.
|
|
94
|
-
|
|
95
|
-
### `#change_priority(item, new_priority)`
|
|
96
|
-
|
|
97
|
-
Updates the priority of an existing item and re-heapifies. Raises `ArgumentError` if the item is not found.
|
|
98
|
-
|
|
99
|
-
### `#to_a`
|
|
100
|
-
|
|
101
|
-
Returns all items sorted by priority.
|
|
102
|
-
|
|
103
|
-
### `#include?(item)`
|
|
104
|
-
|
|
105
|
-
Returns `true` if the item is in the queue.
|
|
106
|
-
|
|
107
|
-
### `#clear`
|
|
108
|
-
|
|
109
|
-
Removes all items from the queue.
|
|
110
|
-
|
|
111
|
-
### `#merge(other)`
|
|
112
|
-
|
|
113
|
-
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 |
|
|
114
90
|
|
|
115
91
|
## Development
|
|
116
92
|
|
|
117
|
-
```
|
|
93
|
+
```bash
|
|
118
94
|
bundle install
|
|
119
95
|
bundle exec rspec
|
|
120
96
|
bundle exec rubocop
|
|
@@ -122,4 +98,4 @@ bundle exec rubocop
|
|
|
122
98
|
|
|
123
99
|
## License
|
|
124
100
|
|
|
125
|
-
MIT
|
|
101
|
+
MIT
|
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.6
|
|
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-24 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,
|
|
@@ -51,5 +51,6 @@ requirements: []
|
|
|
51
51
|
rubygems_version: 3.5.22
|
|
52
52
|
signing_key:
|
|
53
53
|
specification_version: 4
|
|
54
|
-
summary: Binary heap priority queue with min/max modes
|
|
54
|
+
summary: Binary heap priority queue with min/max modes, custom comparators, and priority
|
|
55
|
+
updates
|
|
55
56
|
test_files: []
|