Add Heap data structure implementation with tests#34
Merged
kassane merged 4 commits intoTheAlgorithms:mainfrom Feb 6, 2026
Merged
Add Heap data structure implementation with tests#34kassane merged 4 commits intoTheAlgorithms:mainfrom
kassane merged 4 commits intoTheAlgorithms:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request adds a generic heap data structure implementation to support both min-heaps and max-heaps. The implementation uses an ArrayList-backed binary heap with standard heap operations and integrates with the existing build and test infrastructure.
Changes:
- Added a new generic
Heaptype indataStructures/heap.zigwith insert, extract, peek, and size operations - Updated
build.zigto add build configuration for the heap data structure - Updated
runall.zigto include heap tests in the default test suite - Updated
CONTRIBUTING.mddocumentation to list the new heap.zig file
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| dataStructures/heap.zig | New generic heap implementation with min/max heap support via comparator functions, including siftUp/siftDown operations and comprehensive tests |
| build.zig | Added build configuration for "ds/heap" operation |
| runall.zig | Added heap to the default test suite |
| CONTRIBUTING.md | Updated file listing to include heap.zig in alphabetical order |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
kassane
approved these changes
Feb 6, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new, generic heap data structure implementation and integrates it into the build and test system. The main changes are the addition of a reusable
Heaptype, updates to the build scripts to support building and testing the heap, and documentation updates to reflect the new file.Data Structures:
Heapimplementation indataStructures/heap.zig, supporting both min-heaps and max-heaps via a comparator function, with insert, extract, peek, and size operations. Includes comprehensive tests for both heap types.Build System:
build.zigto support building and running tests for the new heap data structure with the"ds/heap"operation.runall.zigto include the heap data structure in the suite of tests run by default.Documentation:
heap.zigto the list of data structure files inCONTRIBUTING.md.