Add Segment Tree and Dijkstra's Algorithm Implementations with Unit Tests #9
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 new implementations for data structures and algorithms, specifically a Segment Tree and Dijkstra's Algorithm, along with their respective unit tests. The most important changes include the addition of the
SegmentTreeclass, thedijkstrafunction, and their corresponding tests.New Implementations:
src/data_structure/segment_tree.hpp: Added theSegmentTreeclass with methods for building the tree, querying intervals, and updating elements.src/graph/dijkstra.hpp: Added thedijkstrafunction to compute the shortest paths from a single source in a weighted graph using Dijkstra's Algorithm.Unit Tests:
tests/data_structure/segment_tree_test.cpp: Added unit tests for theSegmentTreeclass, including tests for sum and minimum operations.tests/graph/dijkstra_test.cpp: Added unit tests for thedijkstrafunction, including tests for small graphs and graphs with disconnected nodes.