* Performs a preorder traversal of the tree. * * @param {function(SplayTreeNode)} f Visitor function. * @private
(f)
| 258 | * @private |
| 259 | */ |
| 260 | traverse_(f) { |
| 261 | const nodesToVisit = [this.root_]; |
| 262 | while (nodesToVisit.length > 0) { |
| 263 | const node = nodesToVisit.shift(); |
| 264 | if (node === null) continue; |
| 265 | f(node); |
| 266 | nodesToVisit.push(node.left); |
| 267 | nodesToVisit.push(node.right); |
| 268 | } |
| 269 | } |
| 270 | } |
| 271 | |
| 272 | /** |
no test coverage detected