@@ -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) { |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use DataStructures\Lists\Nodes\SimpleLinkedListNode as Node; |
| 6 | 6 | use DataStructures\Lists\Interfaces\ListInterface; |
| 7 | 7 | use OutOfBoundsException; |
| 8 | -use Iterator; |
|
| 9 | 8 | |
| 10 | 9 | /** |
| 11 | 10 | * CircularLinkedList is a single and circular linked list that has |
@@ -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) { |
@@ -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 = null) { |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | * Deletes the node with the minimum key and returns it. The most left and more bottom. |
| 257 | 257 | * |
| 258 | 258 | * @param DataStructures\Trees\Nodes\BSTNode|null if null takes the root. |
| 259 | - * @return DataStructures\Trees\Nodes\BSTNode|null the minimum node or |
|
| 259 | + * @return Node|null the minimum node or |
|
| 260 | 260 | * null if the tree is empty. |
| 261 | 261 | */ |
| 262 | 262 | public function deleteMin(Node $node = null) { |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | * Deletes the node with the maximum key and returns it. The most right and more bottom. |
| 273 | 273 | * |
| 274 | 274 | * @param DataStructures\Trees\Nodes\BSTNode|null if null takes the root. |
| 275 | - * @return DataStructures\Trees\Nodes\BSTNode|null the maximum node or |
|
| 275 | + * @return Node|null the maximum node or |
|
| 276 | 276 | * null if the tree is empty. |
| 277 | 277 | */ |
| 278 | 278 | public function deleteMax(Node $node = null) { |
@@ -288,7 +288,8 @@ discard block |
||
| 288 | 288 | * Deletes the node with the maximum key and returns it. The most right and more bottom. |
| 289 | 289 | * |
| 290 | 290 | * @param DataStructures\Trees\Nodes\BSTNode|null if null takes the root. |
| 291 | - * @return DataStructures\Trees\Nodes\BSTNode|null the maximum node or |
|
| 291 | + * @param integer $key |
|
| 292 | + * @return Node|null the maximum node or |
|
| 292 | 293 | * null if the tree is empty. |
| 293 | 294 | */ |
| 294 | 295 | public function delete($key) { |
@@ -331,7 +332,7 @@ discard block |
||
| 331 | 332 | * that replaces the deleted node. Also decrease the size of tree. |
| 332 | 333 | * |
| 333 | 334 | * @param DataStructures\Trees\Nodes\BSTNode|null The node to be deleted. |
| 334 | - * @return the node that replaces the deleted. |
|
| 335 | + * @return DataStructures\Trees\Nodes\BSTNode|null node that replaces the deleted. |
|
| 335 | 336 | */ |
| 336 | 337 | private function _delete(Node &$node) { |
| 337 | 338 | if($node !== null) { |
@@ -394,7 +395,7 @@ discard block |
||
| 394 | 395 | * Returns true if is leaf the node. |
| 395 | 396 | * |
| 396 | 397 | * @param DataStructures\Trees\Nodes\BSTNode|null $node default to null. |
| 397 | - * @return true if is leaf the node, is not null and their subtrees has no |
|
| 398 | + * @return boolean if is leaf the node, is not null and their subtrees has no |
|
| 398 | 399 | * pointers to successors. |
| 399 | 400 | */ |
| 400 | 401 | public function isLeaf($node) { |
@@ -406,7 +407,7 @@ discard block |
||
| 406 | 407 | * also are called a root node. |
| 407 | 408 | * |
| 408 | 409 | * @param DataStructures\Trees\Nodes\BSTNode|null $node default to null. |
| 409 | - * @return true if is root the node, is not null and their subtrees has no |
|
| 410 | + * @return boolean if is root the node, is not null and their subtrees has no |
|
| 410 | 411 | * pointers to successors. |
| 411 | 412 | */ |
| 412 | 413 | public function isRoot($node) { |