Skip to content

Commit c5afad9

Browse files
committed
Update docs
1 parent b52ecef commit c5afad9

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

src/data-structures/binary-search-tree.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
*
4040
* @public
4141
* @param {Number|String} Value
42-
* @param {[Node]} Current node
42+
* @param {Node} Current node
4343
*/
4444
BinaryTree.prototype.insert = function (value, current) {
4545
if (this._root === null) {
@@ -227,7 +227,7 @@
227227
*
228228
* @private
229229
* @param {Node} Root of the sub-tree
230-
* @param {[Number|String]} Current minimum value of the sub-tree
230+
* @param {Number|String} Current minimum value of the sub-tree
231231
* @returns {Node} The node with minimum value in the sub-tree
232232
*/
233233
BinaryTree.prototype._findMin = function (node, current) {
@@ -244,7 +244,7 @@
244244
*
245245
* @private
246246
* @param {Node} Root of the sub-tree
247-
* @param {[Number|String]} Current maximum value of the sub-tree
247+
* @param {Number|String} Current maximum value of the sub-tree
248248
* @returns {Node} The node with maximum value in the sub-tree
249249
*/
250250
BinaryTree.prototype._findMax = function (node, current) {

src/graphs/searching/bfs.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,30 @@
1313
}
1414

1515
/**
16-
* Returns the shortest path between
17-
* startNode and targetNode.
18-
* Time complexity O(|V|*|V|), because we use adjust matrix.
16+
* Breath-First graph searching algorithm.
17+
* Returns the shortest path between startNode and targetNode.
18+
* Time complexity O(|V|*|V|).
1919
*
20+
* @module graphs/searching
21+
* @public
2022
* @param {array} graph The adjust matrix, which represents the graph
2123
* @param {number} startNode The start node
2224
* @param {number} targetNode The target, which should be reached
25+
* @param {Array} graph Adjacency matrix, which represents the graph.
2326
* @returns {array} The shortest path from startNode to targetNode
27+
* @param {Number} startNode Start node.
28+
* @param {Number} targetNode Target, which should be reached.
29+
* @returns {Array} Shortest path from startNode to targetNode.
30+
*
31+
* @example
32+
* var bfs = require('path-to-algorithms/src/graphs/searching/bfs').bfs;
33+
* var graph = [[1, 1, 0, 0, 1, 0],
34+
* [1, 0, 1, 0, 1, 0],
35+
* [0, 1, 0, 1, 0, 0],
36+
* [0, 0, 1, 0, 1, 1],
37+
* [1, 1, 0, 1, 0, 0],
38+
* [0, 0, 0, 1, 0, 0]];
39+
* var shortestPath = bfs(graph, 1, 5); // [1, 2, 3, 5]
2440
*/
2541
return function (graph, startNode, targetNode) {
2642
var parents = [],

0 commit comments

Comments
 (0)