From 3b02e349f7106fab592956db0069ba86c3269b59 Mon Sep 17 00:00:00 2001 From: PAVAN BANSAL Date: Tue, 4 Oct 2016 21:25:55 +0530 Subject: [PATCH 1/4] Update breadth-first-search.md --- src/graph/breadth-first-search.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/graph/breadth-first-search.md b/src/graph/breadth-first-search.md index ad127df12..4f3c50ef2 100644 --- a/src/graph/breadth-first-search.md +++ b/src/graph/breadth-first-search.md @@ -6,7 +6,7 @@ Breadth first search is one of the basic and essential 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. -The algorithm works in $O (n + m)$ time, where $n$ is number of vertices and $m$ is the number of edges. +The algorithm works in $O(n + m)$ time, where $n$ is number of vertices and $m$ is the number of edges. ## Description of the algorithm @@ -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/) From 931b82ba3ad848bf313291027d72a69b2f162c86 Mon Sep 17 00:00:00 2001 From: PAVAN BANSAL Date: Tue, 4 Oct 2016 21:26:55 +0530 Subject: [PATCH 2/4] U --- src/graph/breadth-first-search.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/graph/breadth-first-search.md b/src/graph/breadth-first-search.md index 4f3c50ef2..f0632f963 100644 --- a/src/graph/breadth-first-search.md +++ b/src/graph/breadth-first-search.md @@ -6,7 +6,7 @@ Breadth first search is one of the basic and essential 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. -The algorithm works in $O(n + m)$ time, where $n$ is number of vertices and $m$ is the number of edges. +The algorithm works in $O (n + m)$ time, where $n$ is number of vertices and $m$ is the number of edges. ## Description of the algorithm From b0b5d8bcca357e6c163143732e40f6d8221bb369 Mon Sep 17 00:00:00 2001 From: PAVAN BANSAL Date: Tue, 4 Oct 2016 21:30:02 +0530 Subject: [PATCH 3/4] Update breadth-first-search.md --- src/graph/breadth-first-search.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/graph/breadth-first-search.md b/src/graph/breadth-first-search.md index f0632f963..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. From f6827ea8e28caba7d2121357c58926aa36e0d10d Mon Sep 17 00:00:00 2001 From: PAVAN BANSAL Date: Tue, 4 Oct 2016 21:53:59 +0530 Subject: [PATCH 4/4] fixed typo --- src/string/z-function.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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.