@@ -11,7 +11,6 @@ |
||
11 | 11 | use DataStructures\Lists\Nodes\SimpleLinkedListNode as Node; |
12 | 12 | use DataStructures\Lists\Interfaces\ListInterface; |
13 | 13 | use OutOfBoundsException; |
14 | -use Iterator; |
|
15 | 14 | |
16 | 15 | /** |
17 | 16 | * CircularLinkedList |
@@ -97,7 +97,6 @@ discard block |
||
97 | 97 | /** |
98 | 98 | * Add a new node in the specified index. |
99 | 99 | * |
100 | - * @param integer $index the position. |
|
101 | 100 | * @param mixed $data the data to be stored. |
102 | 101 | */ |
103 | 102 | private function insertEnd($data) { |
@@ -194,7 +193,7 @@ discard block |
||
194 | 193 | /** |
195 | 194 | * Generator for retrieve all nodes stored. |
196 | 195 | * |
197 | - * @return null if the head is null (or list is empty) |
|
196 | + * @return \Generator if the head is null (or list is empty) |
|
198 | 197 | */ |
199 | 198 | public function getAll() { |
200 | 199 | if($this->head === null) { |
@@ -32,7 +32,7 @@ |
||
32 | 32 | * @param DataStructures\Trees\Nodes\AVLNode|null $left the left child node. |
33 | 33 | * @param DataStructures\Trees\Nodes\AVLNode|null $right the right child node. |
34 | 34 | * |
35 | - * @return DataStructures\Trees\Nodes\AVLNode the new node created. |
|
35 | + * @return AVLNode the new node created. |
|
36 | 36 | */ |
37 | 37 | public function createNode($key, $data, $parent = null, $left = null, $right = null) { |
38 | 38 | return new AVLNode($key, $data, $parent, $left, $right); |
@@ -98,7 +98,7 @@ |
||
98 | 98 | /** |
99 | 99 | * Generator for retrieve all nodes stored. |
100 | 100 | * |
101 | - * @return null if the head is null (or list is empty) |
|
101 | + * @return \Generator if the head is null (or list is empty) |
|
102 | 102 | */ |
103 | 103 | public function getAll() { |
104 | 104 | if($this->head === null) { |
@@ -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) { |