@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | /** |
| 235 | 235 | * Returns the minimum node from a given node in position X. |
| 236 | 236 | * |
| 237 | - * @param DataStructures\Trees\Nodes\BSTNode $node the start point. |
|
| 237 | + * @param BinaryNodeInterface $node the start point. |
|
| 238 | 238 | * @return DataStructures\Trees\Nodes\BSTNode|null the minimum node. |
| 239 | 239 | */ |
| 240 | 240 | private function getMinNode(BinaryNodeInterface $node = null) { |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | /** |
| 253 | 253 | * Returns the maximum node from a given node in position X. |
| 254 | 254 | * |
| 255 | - * @param DataStructures\Trees\Nodes\BSTNode $node the start point. |
|
| 255 | + * @param BinaryNodeInterface $node the start point. |
|
| 256 | 256 | * @return DataStructures\Trees\Nodes\BSTNode|null the maximum node. |
| 257 | 257 | */ |
| 258 | 258 | private function getMaxNode(BinaryNodeInterface $node = null) { |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | * Deletes the node with the minimum key and returns it. The most left and more bottom. |
| 272 | 272 | * |
| 273 | 273 | * @param DataStructures\Trees\Nodes\BSTNode|null if null takes the root. |
| 274 | - * @return DataStructures\Trees\Nodes\BSTNode|null the minimum node or |
|
| 274 | + * @return BinaryNodeInterface|null the minimum node or |
|
| 275 | 275 | * null if the tree is empty. |
| 276 | 276 | */ |
| 277 | 277 | public function deleteMin(BinaryNodeInterface $node = null) { |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | * Deletes the node with the maximum key and returns it. The most right and more bottom. |
| 288 | 288 | * |
| 289 | 289 | * @param DataStructures\Trees\Nodes\BSTNode|null if null takes the root. |
| 290 | - * @return DataStructures\Trees\Nodes\BSTNode|null the maximum node or |
|
| 290 | + * @return BinaryNodeInterface|null the maximum node or |
|
| 291 | 291 | * null if the tree is empty. |
| 292 | 292 | */ |
| 293 | 293 | public function deleteMax(BinaryNodeInterface $node = null) { |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | * Deletes the node with the maximum key and returns it. The most right and more bottom. |
| 304 | 304 | * |
| 305 | 305 | * @param DataStructures\Trees\Nodes\BSTNode|null if null takes the root. |
| 306 | - * @return DataStructures\Trees\Nodes\BSTNode|null the maximum node or |
|
| 306 | + * @return BinaryNodeInterface|null the maximum node or |
|
| 307 | 307 | * null if the tree is empty. |
| 308 | 308 | */ |
| 309 | 309 | public function delete($key) { |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | * that replaces the deleted node. Also decrease the size of tree. |
| 322 | 322 | * |
| 323 | 323 | * @param DataStructures\Trees\Nodes\BSTNode|null The node to be deleted. |
| 324 | - * @return the node that replaces the deleted. |
|
| 324 | + * @return DataStructures\Trees\Nodes\BSTNode|null node that replaces the deleted. |
|
| 325 | 325 | */ |
| 326 | 326 | protected function _delete(BinaryNodeInterface &$node) { |
| 327 | 327 | if($node !== null) { |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | * Returns true if is leaf the node. |
| 410 | 410 | * |
| 411 | 411 | * @param DataStructures\Trees\Nodes\BSTNode|null $node default to null. |
| 412 | - * @return true if is leaf the node, is not null and their subtrees has no |
|
| 412 | + * @return boolean if is leaf the node, is not null and their subtrees has no |
|
| 413 | 413 | * pointers to successors. |
| 414 | 414 | */ |
| 415 | 415 | public function isLeaf($node) : bool { // BinaryTreeNode |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | * also are called a root node. |
| 422 | 422 | * |
| 423 | 423 | * @param DataStructures\Trees\Nodes\BSTNode|null $node default to null. |
| 424 | - * @return true if is root the node, is not null and their subtrees has no |
|
| 424 | + * @return boolean if is root the node, is not null and their subtrees has no |
|
| 425 | 425 | * pointers to successors. |
| 426 | 426 | */ |
| 427 | 427 | public function isRoot($node) : bool { |
@@ -446,6 +446,7 @@ discard block |
||
| 446 | 446 | * @param DataStructures\Trees\Nodes\BSTNode|null $node. |
| 447 | 447 | * @param Callable|null $callback the callback function to apply to each |
| 448 | 448 | * node. |
| 449 | + * @param null|DataStructures\Trees\Nodes\BSTNode $node |
|
| 449 | 450 | */ |
| 450 | 451 | private function _preorder($node, Callable $callback = null) { |
| 451 | 452 | if($node === null) { |
@@ -476,6 +477,7 @@ discard block |
||
| 476 | 477 | * @param DataStructures\Trees\Nodes\BSTNode|null $node. |
| 477 | 478 | * @param Callable|null $callback the callback function to apply to each |
| 478 | 479 | * node. |
| 480 | + * @param null|DataStructures\Trees\Nodes\BSTNode $node |
|
| 479 | 481 | */ |
| 480 | 482 | private function _inorder($node, Callable $callback = null) { |
| 481 | 483 | if($node === null) { |
@@ -507,6 +509,7 @@ discard block |
||
| 507 | 509 | * @param DataStructures\Trees\Nodes\BSTNode|null $node. |
| 508 | 510 | * @param Callable|null $callback the callback function to apply to each |
| 509 | 511 | * node. |
| 512 | + * @param null|DataStructures\Trees\Nodes\BSTNode $node |
|
| 510 | 513 | */ |
| 511 | 514 | private function _postorder($node, Callable $callback = null) { |
| 512 | 515 | if($node === null) { |
@@ -99,7 +99,6 @@ discard block |
||
| 99 | 99 | /** |
| 100 | 100 | * Add a new node in the specified index. |
| 101 | 101 | * |
| 102 | - * @param integer $index the position. |
|
| 103 | 102 | * @param mixed $data the data to be stored. |
| 104 | 103 | */ |
| 105 | 104 | private function insertEnd($data) { |
@@ -166,7 +165,7 @@ discard block |
||
| 166 | 165 | /** |
| 167 | 166 | * Returns the last node with O(1). |
| 168 | 167 | * |
| 169 | - * @return mixed null if the list is empty. |
|
| 168 | + * @return null|Node null if the list is empty. |
|
| 170 | 169 | */ |
| 171 | 170 | protected function searchLast() { |
| 172 | 171 | if($this->head === null) { |
@@ -241,7 +240,7 @@ discard block |
||
| 241 | 240 | /** |
| 242 | 241 | * Generator for retrieve all nodes stored. |
| 243 | 242 | * |
| 244 | - * @return null if the head is null (or list is empty) |
|
| 243 | + * @return \Generator if the head is null (or list is empty) |
|
| 245 | 244 | */ |
| 246 | 245 | public function getAll() { |
| 247 | 246 | if($this->head === null) { |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | /** |
| 138 | 138 | * Returns the last node with O(1). |
| 139 | 139 | * |
| 140 | - * @return DataStructures\Lists\Nodes\DoublyLinkedListNode|null if the list is empty. |
|
| 140 | + * @return null|Node if the list is empty. |
|
| 141 | 141 | */ |
| 142 | 142 | public function searchLast() { |
| 143 | 143 | if($this->head === null) { |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | /** |
| 150 | 150 | * Generator for retrieve all nodes stored. |
| 151 | 151 | * |
| 152 | - * @return null if the head is null (or list is empty) |
|
| 152 | + * @return \Generator if the head is null (or list is empty) |
|
| 153 | 153 | */ |
| 154 | 154 | public function getAll() { |
| 155 | 155 | if($this->head === null) { |