* Returns the node having the specified key or null if the tree doesn't contain * a node with the specified key. * * @param {number} key Key to find in the tree. * @return {SplayTreeNode} Node having the specified key.
(key)
| 122 | * @return {SplayTreeNode} Node having the specified key. |
| 123 | */ |
| 124 | find(key) { |
| 125 | if (this.isEmpty()) return null; |
| 126 | this.splay_(key); |
| 127 | return this.root_.key == key ? this.root_ : null; |
| 128 | } |
| 129 | |
| 130 | /** |
| 131 | * @return {SplayTreeNode} Node having the minimum key value. |