File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323 "disallowMultipleLineBreaks" : true ,
2424 "disallowKeywordsOnNewLine" : [" else" ],
2525 "requireLineFeedAtFileEnd" : true ,
26+ "disallowTrailingWhitespace" : true ,
2627 "excludeFiles" : [" node_modules/**" , " bower_components/**" ],
2728 "validateIndentation" : 2
2829}
Original file line number Diff line number Diff line change 11/**
22 * Run-length encoding.
3- * The idea of this algorithm is to remove the usless zeros and
3+ * The idea of this algorithm is to remove the usless zeros and
44 * give us representation of string in binary which in which the
55 * zeros will be stripped and replaced with their count.
66 */
Original file line number Diff line number Diff line change 190190 /**
191191 * Finds a node by it's value in a given sub-tree.
192192 * Average time complexity: O(log N).
193- *
193+ *
194194 * @private
195195 * @param {Number|String } Value of the node which should be found.
196196 * @param {Node } Current node to be checked.
221221 * @param {Node } oldChild Child to be replaced.
222222 * @param {Node } newChild Child replacement.
223223 */
224- exports . BinaryTree . prototype . _replaceChild =
224+ exports . BinaryTree . prototype . _replaceChild =
225225 function ( parent , oldChild , newChild ) {
226226 if ( ! parent ) {
227227 this . _root = newChild ;
Original file line number Diff line number Diff line change 9797 /**
9898 * Changes the key.<br><br>
9999 * Complexity: O(log N).
100- *
100+ *
101101 * @public
102102 * @param {Number } index Index of the value which should be changed.
103103 * @param {Number|Object } value New value according to the index.
Original file line number Diff line number Diff line change 2424
2525 /**
2626 * Node which describes an interval.
27- *
27+ *
2828 * @public
2929 * @constructor
3030 * @param {Number } start Start of the interval.
3939 */
4040 this . interval = [ start , end ] ;
4141 /**
42- * Max endpoint in subtree which starts from this node.
42+ * Max endpoint in subtree which starts from this node.
4343 * @member {Number}
4444 */
4545 this . max = - Infinity ;
106106
107107 /**
108108 * Add new interval to the tree.
109- *
109+ *
110110 * @public
111111 * @param {Array } intreval Array with start and end points of the interval.
112112 */
141141 /**
142142 * Checks or point belongs to at least one intarval from the tree.<br><br>
143143 * Complexity: O(log N).
144- *
144+ *
145145 * @public
146146 * @method
147147 * @param {Number } point Point which should be checked.
196196
197197 /**
198198 * Returns height of the tree.
199- *
199+ *
200200 * @public
201201 * @method
202202 * @return {Number } Height of the tree.
Original file line number Diff line number Diff line change 11/**
22 * Red-Black tree is a data structure which is
33 * a type of self-balancing binary search tree.
4- *
4+ *
55 * @example
66 *
77 * var RBTree = require('../src/data-structures/red-black-tree').RBTree;
2525 * });
2626 *
2727 * console.log(rbTree.get(1989)); // { name: 'Garry', surname: 'Fisher' }
28- *
28+ *
2929 * @module data-structures/red-black-tree
3030 */
3131( function ( exports ) {
4343
4444 /**
4545 * Node of the Red-Black tree.
46- *
46+ *
4747 * @private
4848 * @constructor
4949 * @param {Number } key Key of the node.
105105
106106 /**
107107 * Red-Black Tree.
108- *
108+ *
109109 * @public
110110 * @constructor
111111 */
116116 /**
117117 * Add value associated with a given key.<br><br>
118118 * Complexity: O(log N).
119- *
119+ *
120120 * @public
121121 * @method
122122 * @param {Number } key Key.
130130 /**
131131 * Returns true or false depending on whether
132132 * given node is red.
133- *
133+ *
134134 * @private
135135 * @method
136136 * @param {Node } node Node which sould be checked.
146146 /**
147147 * Helper function for insertion of given key,
148148 * value pair into the Red-Black tree.
149- *
149+ *
150150 * @private
151151 * @method
152152 * @param {Number } key Key.
Original file line number Diff line number Diff line change 6363 }
6464
6565 /**
66- * Dijkstra's shortest path algorithm. Finds the minimum
66+ * Dijkstra's shortest path algorithm. Finds the minimum
6767 * distance between two given nodes using a distance matrix.<br><br>
6868 * For the implementation is not used the most suitable data structure
6969 * (Fibonacci heap) but the Binary heap gives also good results.<br><br>
7070 *
7171 * Time complexity: O(|E|+|V|log(|V|)) where V and E are the number of
7272 * vertices and edges respectively.
73- *
73+ *
7474 * @public
7575 * @module graphs/shortest-path/dijkstra
7676 * @param {Number } src Source node.
7777 * @param {Number } dest Destination node.
7878 * @param {Array } graph A distance matrix of the graph.
7979 * @returns {Number } The shortest distance between two nodes.
80- *
80+ *
8181 * @example
8282 * var dijkstra =
8383 * require('path-to-algorithms/src/graphs/shortest-path/dijkstra').dijkstra;
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ describe('BFS', function () {
4141 *
4242 * 0 ---> 1
4343 * \ |
44- * \ v
44+ * \ v
4545 * -> 2
4646 */
4747 it ( 'should not update the parent node once set' , function ( ) {
You can’t perform that action at this time.
0 commit comments