diff --git a/src/graph/breadth-first-search.md b/src/graph/breadth-first-search.md index ad127df12..1501f768e 100644 --- a/src/graph/breadth-first-search.md +++ b/src/graph/breadth-first-search.md @@ -1,7 +1,7 @@ # Breadth-first search -Breadth first search is one of the basic and essential algorithms on graphs. +Breadth first search is one of the basic and essential searching algorithms on graphs. 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 the path that contains the smallest number of edges in unweighted graphs. @@ -97,5 +97,6 @@ manner: * [SPOJ: AKBAR](http://spoj.com/problems/AKBAR) * [SPOJ: NAKANJ](http://www.spoj.com/problems/NAKANJ/) * [SPOJ: WATER](http://www.spoj.com/problems/WATER) +* [SPOJ: MICE AND MAZE](http://www.spoj.com/problems/MICEMAZE/) diff --git a/src/string/z-function.md b/src/string/z-function.md index 96d309bda..0ebe1f337 100644 --- a/src/string/z-function.md +++ b/src/string/z-function.md @@ -7,7 +7,7 @@ In other words, $z[i]$ is the length of the longest common prefix between $s$ an **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$. -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). +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). This article presents an algorithm for calculating the Z-function in $O(n)$ time, as well as various of its applications.