| 255 |
255 |
| 256 size_t cxTreeSubtreeSize(CxTree *tree, void *subtree_root); |
256 size_t cxTreeSubtreeSize(CxTree *tree, void *subtree_root); |
| 257 |
257 |
| 258 size_t cxTreeSubtreeDepth(CxTree *tree, void *subtree_root); |
258 size_t cxTreeSubtreeDepth(CxTree *tree, void *subtree_root); |
| 259 |
259 |
| |
260 size_t cxTreeSize(CxTree *tree); |
| |
261 |
| 260 size_t cxTreeDepth(CxTree *tree); |
262 size_t cxTreeDepth(CxTree *tree); |
| 261 ``` |
263 ``` |
| 262 |
264 |
| 263 The function `cxTreeSubtreeSize()` counts all nodes belonging to the subtree starting with `subtree_root`. |
265 The function `cxTreeSubtreeSize()` counts all nodes belonging to the subtree starting with `subtree_root`. |
| 264 |
266 |
| 265 The function `cxTreeSubtreeDepth()` reports the maximum depth of the subtree starting with `subtree_root`. |
267 The function `cxTreeSubtreeDepth()` reports the maximum depth of the subtree starting with `subtree_root`. |
| 266 If the `subtree_root` does not have any children, this results in a depth of one. |
268 If the `subtree_root` does not have any children, this results in a depth of one. |
| 267 |
269 |
| 268 The function `cxTreeDepth()` is equivalent to `cxTreeSubtreeDepth()` where `subtree_root` is the root node of the entire tree. |
270 The functions `cxTreeSize()` and `cxTreeDepth()` are equivalent to `cxTreeSubtreeSize()` and `cxTreeSubtreeDepth()`, respectively, where `subtree_root` is the root node of the entire tree. |
| 269 |
271 |
| 270 > Passing a `NULL` pointer as `subtree_root` makes those functions return zero. |
272 > Passing a `NULL` pointer as `subtree_root` makes those functions return zero. |
| 271 |
|
| 272 > In the current UCX version there is no separate function `cxTreeSize()`, because |
|
| 273 > the size attribute can be directly accessed in the `CxTree` structure. |
|
| 274 > The next UCX version is planned to have also a function for accessing that attribute. |
|
| 275 >{style="note"} |
|
| 276 |
273 |
| 277 ## Search |
274 ## Search |
| 278 |
275 |
| 279 ```C |
276 ```C |
| 280 #include <cx/tree.h> |
277 #include <cx/tree.h> |