Skip to content

Commit 968a0e0

Browse files
authored
Merge pull request #50 from PAVBAN95/master
Improvements to BFS and Z-function
2 parents 377ae9a + f6827ea commit 968a0e0

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/graph/breadth-first-search.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!--?title Breadth First Search -->
22

33
# Breadth-first search
4-
Breadth first search is one of the basic and essential algorithms on graphs.
4+
Breadth first search is one of the basic and essential searching algorithms on graphs.
55

66
As a result of how the algorithm works, the path found by breadth first search to any node is the shortest path to that node i.e
77
the path that contains the smallest number of edges in unweighted graphs.
@@ -97,5 +97,6 @@ manner:
9797
* [SPOJ: AKBAR](http://spoj.com/problems/AKBAR)
9898
* [SPOJ: NAKANJ](http://www.spoj.com/problems/NAKANJ/)
9999
* [SPOJ: WATER](http://www.spoj.com/problems/WATER)
100+
* [SPOJ: MICE AND MAZE](http://www.spoj.com/problems/MICEMAZE/)
100101

101102

src/string/z-function.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ In other words, $z[i]$ is the length of the longest common prefix between $s$ an
77

88
**Note.** In this article, to avoid ambiguity, we assume $0$-based indexes; that is: the first character of $s$ has index $0$ and the last one has index $n-1$.
99

10-
The first element of Z-functions, $z[0]$, is generally not well defined. In this article we will assume it is zero (although it doesn't change anything in the algorithm implementation).
10+
The first element of Z-function, $z[0]$, is generally not well defined. In this article we will assume it is zero (although it doesn't change anything in the algorithm implementation).
1111

1212
This article presents an algorithm for calculating the Z-function in $O(n)$ time, as well as various of its applications.
1313

0 commit comments

Comments
 (0)