@@ -89,7 +89,6 @@ discard block |
||
89 | 89 | /** |
90 | 90 | * Add a new node in the specified index. |
91 | 91 | * |
92 | - * @param integer $index the position. |
|
93 | 92 | * @param mixed $data the data to be stored. |
94 | 93 | */ |
95 | 94 | private function insertEnd($data) { |
@@ -133,7 +132,7 @@ discard block |
||
133 | 132 | /** |
134 | 133 | * Adds at the beginning a node in the list. |
135 | 134 | * |
136 | - * @param mixed $data |
|
135 | + * @param integer $data |
|
137 | 136 | * @return mixed the data stored. |
138 | 137 | */ |
139 | 138 | public function unshift($data) { |
@@ -186,7 +185,7 @@ discard block |
||
186 | 185 | /** |
187 | 186 | * Generator for retrieve all nodes stored. |
188 | 187 | * |
189 | - * @return null if the head is null (or list is empty) |
|
188 | + * @return \Generator if the head is null (or list is empty) |
|
190 | 189 | */ |
191 | 190 | public function getAll() { |
192 | 191 | if($this->head === null) { |
@@ -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 |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | /** |
91 | 91 | * Generator for retrieve all nodes stored. |
92 | 92 | * |
93 | - * @return null if the head is null (or list is empty) |
|
93 | + * @return \Generator if the head is null (or list is empty) |
|
94 | 94 | */ |
95 | 95 | public function getAll() { |
96 | 96 | if($this->head === null) { |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | /** |
212 | 212 | * Adds at the beginning a node in the list. |
213 | 213 | * |
214 | - * @param mixed $data |
|
214 | + * @param integer $data |
|
215 | 215 | * @return mixed the data stored. |
216 | 216 | */ |
217 | 217 | public function unshift($data) { |
@@ -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); |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | /** |
89 | 89 | * Creates a new node or updates it if already exists. |
90 | 90 | * |
91 | - * @param int|string $key the key. |
|
92 | - * @param mixed $data the data to be stored. |
|
91 | + * @param integer $key the key. |
|
92 | + * @param string $data the data to be stored. |
|
93 | 93 | */ |
94 | 94 | public function putOrUpdate($key, $data) { |
95 | 95 | $this->put($key, $data, true); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | /** |
99 | 99 | * Retrieve the data stored in the tree. |
100 | 100 | * |
101 | - * @param int|string $key the key to identify the data. |
|
101 | + * @param integer $key the key to identify the data. |
|
102 | 102 | * @return mixed |
103 | 103 | */ |
104 | 104 | 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 { |
@@ -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,8 @@ 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 | + * @param integer $key |
|
307 | + * @return BinaryNodeInterface|null the maximum node or |
|
307 | 308 | * null if the tree is empty. |
308 | 309 | */ |
309 | 310 | public function delete($key) { |
@@ -321,7 +322,7 @@ discard block |
||
321 | 322 | * that replaces the deleted node. Also decrease the size of tree. |
322 | 323 | * |
323 | 324 | * @param DataStructures\Trees\Nodes\BSTNode|null The node to be deleted. |
324 | - * @return the node that replaces the deleted. |
|
325 | + * @return DataStructures\Trees\Nodes\BSTNode|null node that replaces the deleted. |
|
325 | 326 | */ |
326 | 327 | protected function _delete(BinaryNodeInterface &$node) { |
327 | 328 | if($node !== null) { |
@@ -409,7 +410,7 @@ discard block |
||
409 | 410 | * Returns true if is leaf the node. |
410 | 411 | * |
411 | 412 | * @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 |
|
413 | + * @return boolean if is leaf the node, is not null and their subtrees has no |
|
413 | 414 | * pointers to successors. |
414 | 415 | */ |
415 | 416 | public function isLeaf($node) : bool { // BinaryTreeNode |
@@ -421,7 +422,7 @@ discard block |
||
421 | 422 | * also are called a root node. |
422 | 423 | * |
423 | 424 | * @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 |
|
425 | + * @return boolean if is root the node, is not null and their subtrees has no |
|
425 | 426 | * pointers to successors. |
426 | 427 | */ |
427 | 428 | public function isRoot($node) : bool { |
@@ -446,6 +447,7 @@ discard block |
||
446 | 447 | * @param DataStructures\Trees\Nodes\BSTNode|null $node. |
447 | 448 | * @param Callable|null $callback the callback function to apply to each |
448 | 449 | * node. |
450 | + * @param null|DataStructures\Trees\Nodes\BSTNode $node |
|
449 | 451 | */ |
450 | 452 | private function _preorder($node, Callable $callback = null) { |
451 | 453 | if($node === null) { |
@@ -476,6 +478,7 @@ discard block |
||
476 | 478 | * @param DataStructures\Trees\Nodes\BSTNode|null $node. |
477 | 479 | * @param Callable|null $callback the callback function to apply to each |
478 | 480 | * node. |
481 | + * @param null|DataStructures\Trees\Nodes\BSTNode $node |
|
479 | 482 | */ |
480 | 483 | private function _inorder($node, Callable $callback = null) { |
481 | 484 | if($node === null) { |
@@ -507,6 +510,7 @@ discard block |
||
507 | 510 | * @param DataStructures\Trees\Nodes\BSTNode|null $node. |
508 | 511 | * @param Callable|null $callback the callback function to apply to each |
509 | 512 | * node. |
513 | + * @param null|DataStructures\Trees\Nodes\BSTNode $node |
|
510 | 514 | */ |
511 | 515 | private function _postorder($node, Callable $callback = null) { |
512 | 516 | if($node === null) { |