@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace DataStructures\Trees; |
4 | 4 | |
5 | 5 | use DataStructures\Trees\Interfaces\TreeInterface; |
6 | -use DataStructures\Trees\Nodes\AVLNode as Node; |
|
7 | 6 | |
8 | 7 | class AVLTree implements TreeInterface { |
9 | 8 | public function empty() { |
@@ -84,8 +84,8 @@ discard block |
||
84 | 84 | /** |
85 | 85 | * Creates a new node or updates it if already exists. |
86 | 86 | * |
87 | - * @param int|string $key the key. |
|
88 | - * @param mixed $data the data to be stored. |
|
87 | + * @param integer $key the key. |
|
88 | + * @param string $data the data to be stored. |
|
89 | 89 | */ |
90 | 90 | public function putOrUpdate($key, $data) { |
91 | 91 | $this->put($key, $data, true); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | /** |
95 | 95 | * Retrieve the data stored in the tree. |
96 | 96 | * |
97 | - * @param int|string $key the key to identify the data. |
|
97 | + * @param integer $key the key to identify the data. |
|
98 | 98 | * @return mixed |
99 | 99 | */ |
100 | 100 | public function get($key) { |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | /** |
133 | 133 | * Looks for the node with the given key. |
134 | 134 | * |
135 | - * @param int|string $key the key used to look for. |
|
135 | + * @param string $key the key used to look for. |
|
136 | 136 | * @return bool true if was found. |
137 | 137 | */ |
138 | 138 | public function exists($key) : bool { |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | /** |
197 | 197 | * Returns the minimum node from a given node in position X. |
198 | 198 | * |
199 | - * @param DataStructures\Trees\Nodes\BSTNode $node the start point. |
|
199 | + * @param Node $node the start point. |
|
200 | 200 | * @return DataStructures\Trees\Nodes\BSTNode|null the minimum node. |
201 | 201 | */ |
202 | 202 | private function getMinNode(Node $node = null) { |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | /** |
238 | 238 | * Returns the maximum node from a given node in position X. |
239 | 239 | * |
240 | - * @param DataStructures\Trees\Nodes\BSTNode $node the start point. |
|
240 | + * @param Node $node the start point. |
|
241 | 241 | * @return DataStructures\Trees\Nodes\BSTNode|null the maximum node. |
242 | 242 | */ |
243 | 243 | private function getMaxNode(Node $node) { |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | * Deletes the node with the minimum key and returns it. The most left and more bottom. |
253 | 253 | * |
254 | 254 | * @param DataStructures\Trees\Nodes\BSTNode|null if null takes the root. |
255 | - * @return DataStructures\Trees\Nodes\BSTNode|null the minimum node or |
|
255 | + * @return Node|null the minimum node or |
|
256 | 256 | * null if the tree is empty. |
257 | 257 | */ |
258 | 258 | public function deleteMin(Node $node = null) { |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | * Deletes the node with the maximum key and returns it. The most right and more bottom. |
269 | 269 | * |
270 | 270 | * @param DataStructures\Trees\Nodes\BSTNode|null if null takes the root. |
271 | - * @return DataStructures\Trees\Nodes\BSTNode|null the maximum node or |
|
271 | + * @return Node|null the maximum node or |
|
272 | 272 | * null if the tree is empty. |
273 | 273 | */ |
274 | 274 | public function deleteMax(Node $node = null) { |
@@ -284,7 +284,8 @@ discard block |
||
284 | 284 | * Deletes the node with the maximum key and returns it. The most right and more bottom. |
285 | 285 | * |
286 | 286 | * @param DataStructures\Trees\Nodes\BSTNode|null if null takes the root. |
287 | - * @return DataStructures\Trees\Nodes\BSTNode|null the maximum node or |
|
287 | + * @param integer $key |
|
288 | + * @return Node|null the maximum node or |
|
288 | 289 | * null if the tree is empty. |
289 | 290 | */ |
290 | 291 | public function delete($key) { |
@@ -327,7 +328,7 @@ discard block |
||
327 | 328 | * that replaces the deleted node. Also decrease the size of tree. |
328 | 329 | * |
329 | 330 | * @param DataStructures\Trees\Nodes\BSTNode|null The node to be deleted. |
330 | - * @return the node that replaces the deleted. |
|
331 | + * @return DataStructures\Trees\Nodes\BSTNode|null node that replaces the deleted. |
|
331 | 332 | */ |
332 | 333 | private function _delete(Node &$node) { |
333 | 334 | if($node !== null) { |
@@ -390,7 +391,7 @@ discard block |
||
390 | 391 | * Returns true if is leaf the node. |
391 | 392 | * |
392 | 393 | * @param DataStructures\Trees\Nodes\BSTNode|null $node default to null. |
393 | - * @return true if is leaf the node, is not null and their subtrees has no |
|
394 | + * @return boolean if is leaf the node, is not null and their subtrees has no |
|
394 | 395 | * pointers to successors. |
395 | 396 | */ |
396 | 397 | public function isLeaf($node) { |
@@ -402,7 +403,7 @@ discard block |
||
402 | 403 | * also are called a root node. |
403 | 404 | * |
404 | 405 | * @param DataStructures\Trees\Nodes\BSTNode|null $node default to null. |
405 | - * @return true if is root the node, is not null and their subtrees has no |
|
406 | + * @return boolean if is root the node, is not null and their subtrees has no |
|
406 | 407 | * pointers to successors. |
407 | 408 | */ |
408 | 409 | public function isRoot($node) { |