Skip to content

Commit a506a36

Browse files
committedJul 5, 2024
Merge branch 'develop'
2 parents 7291ace + 40143ad commit a506a36

File tree

124 files changed

+650
-590
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+650
-590
lines changed
 

‎README.md

+4
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,8 @@ MutableValueGraph<City, Distance> roads = ValueGraphBuilder.directed()
227227

228228
**Graph algorithms**
229229

230+
> NOTE: In the following, the C++ implementations are currently only available on MSVC.
231+
230232
- A\* search algorithm, CCSP#2.2.5: A single-pair shortest path algorithm. This is a variant of Dijkstra's algorithm using heuristics to try to speed up the search.
231233
- Bellman-Ford algorithm, CLRS#24.1: [c++](cpp-algorithm/src/cpp-algorithm/src/graph/bellman_ford.h), [java#1](java-algorithm/src/main/java/com/example/algorithm/graph/BellmanFord1.java), [java#2](java-algorithm/src/main/java/com/example/algorithm/graph/BellmanFord2.java) | A single source the shortest path algorithm that can handle negative edge weights. It finds the shortest path from a source vertex to all other vertices in a weighted graph.
232234
@@ -387,6 +389,8 @@ algorithm Prim(G, root):
387389

388390
**Examples**
389391

392+
> NOTE: In the following, the C++ implementations are currently only available on MSVC.
393+
390394
- Maze problem: [java](java-algorithm/src/main/java/com/example/algorithm/graph/MazeProblem.java) | A maze problem is that find a path from the start to the goal. The maze is represented by a graph. The start and the goal are represented by vertices. The path is represented by a sequence of vertices.
391395
- Minimum spanning tree (Kruskal, Prim, Boruvka), CLRS#23, CCSP#4.4.2: [python(test)](python-algorithm/algorithm/graph/test/test_minimum_spanning_tree.py) | Find the minimum spanning tree of a graph. cf. Kruskal(CLRS#23.2, CLRS#21.1), Prim(CLRS#23.2)
392396

‎cpp-algorithm/src/array/advancing_through.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
auto AdvancingThrough::CanReachEnd(const std::vector<int>& max_advance_steps) -> bool
44
{
5-
auto furthest_reach_so_far = 0;
6-
const auto last_index = static_cast<int>(max_advance_steps.size()) - 1;
5+
int reach_so_far = 0; // furthest reach so far
6+
const int last_index = static_cast<int>(max_advance_steps.size()) - 1;
77

8-
for (int i = 0; i <= furthest_reach_so_far && furthest_reach_so_far < last_index; ++i)
8+
for (int i = 0; i <= reach_so_far && reach_so_far < last_index; ++i)
99
{
10-
furthest_reach_so_far = std::max(furthest_reach_so_far, max_advance_steps[i] + i);
10+
reach_so_far = std::max(reach_so_far, max_advance_steps[i] + i);
1111
}
1212

13-
return furthest_reach_so_far >= last_index;
13+
return reach_so_far >= last_index;
1414
}

0 commit comments

Comments
 (0)
Please sign in to comment.