|
44 | 44 | this._left = left; |
45 | 45 | this._right = right; |
46 | 46 | this._parent = parent; |
47 | | - } |
| 47 | + }; |
48 | 48 |
|
49 | 49 | /** |
50 | 50 | * Binary tree. |
|
54 | 54 | */ |
55 | 55 | exports.BinaryTree = function() { |
56 | 56 | this._root = null; |
57 | | - } |
| 57 | + }; |
58 | 58 |
|
59 | 59 | /** |
60 | 60 | * Inserts a node into the binary search tree.<br><br> |
|
90 | 90 | * |
91 | 91 | * @private |
92 | 92 | * @param {Node} current Node from which to start the traversal. |
93 | | - * @param {Function} callback Callback which will be called for each traversed node. |
| 93 | + * @param {Function} callback Callback which will be called |
| 94 | + * for each traversed node. |
94 | 95 | */ |
95 | 96 | exports.BinaryTree.prototype._inorder = function (current, callback) { |
96 | 97 | if (!current) { |
|
108 | 109 | * |
109 | 110 | * @public |
110 | 111 | * @method |
111 | | - * @param {Function} callback Callback which will be called for each traversed node. |
| 112 | + * @param {Function} callback Callback which will be |
| 113 | + * called for each traversed node. |
112 | 114 | */ |
113 | 115 | exports.BinaryTree.prototype.inorder = function (callback) { |
114 | 116 | return this._inorder(this._root, callback); |
|
119 | 121 | * |
120 | 122 | * @private |
121 | 123 | * @param {Node} current Node from which to start the traversal. |
122 | | - * @param {Function} callback Callback which will be called for each traversed node. |
| 124 | + * @param {Function} callback Callback which will be called |
| 125 | + * for each traversed node. |
123 | 126 | */ |
124 | 127 | exports.BinaryTree.prototype._postorder = function (current, callback) { |
125 | 128 | if (!current) { |
|
136 | 139 | * Post-order traversal of the whole tree. |
137 | 140 | * |
138 | 141 | * @public |
139 | | - * @param {Function} callback Callback which will be called for each traversed node. |
| 142 | + * @param {Function} callback Callback which |
| 143 | + * will be called for each traversed node. |
140 | 144 | */ |
141 | 145 | exports.BinaryTree.prototype.postorder = function (callback) { |
142 | 146 | return this._postorder(this._root, callback); |
|
147 | 151 | * |
148 | 152 | * @private |
149 | 153 | * @param {Node} current Node from which to start the traversal. |
150 | | - * @param {Function} callback Callback which will be called for each traversed node. |
| 154 | + * @param {Function} callback Callback which |
| 155 | + * will be called for each traversed node. |
151 | 156 | */ |
152 | 157 | exports.BinaryTree.prototype._preorder = function (current, callback) { |
153 | 158 | if (!current) { |
|
164 | 169 | * Pre-order preorder traversal of the whole tree. |
165 | 170 | * |
166 | 171 | * @public |
167 | | - * @param {Function} callback Callback which will be called for each traversed node. |
| 172 | + * @param {Function} callback Callback which will |
| 173 | + * be called for each traversed node. |
168 | 174 | */ |
169 | 175 | exports.BinaryTree.prototype.preorder = function (callback) { |
170 | 176 | return this._preorder(this._root, callback); |
|
215 | 221 | * @param {Node} oldChild Child to be replaced. |
216 | 222 | * @param {Node} newChild Child replacement. |
217 | 223 | */ |
218 | | - exports.BinaryTree.prototype._replaceChild = function (parent, oldChild, newChild) { |
| 224 | + exports.BinaryTree.prototype._replaceChild = |
| 225 | + function (parent, oldChild, newChild) { |
219 | 226 | if (!parent) { |
220 | 227 | this._root = newChild; |
221 | 228 | this._root._parent = null; |
|
0 commit comments