diff options
author | scratko <m@scratko.xyz> | 2024-03-30 20:23:17 +0300 |
---|---|---|
committer | scratko <m@scratko.xyz> | 2024-03-30 20:23:17 +0300 |
commit | 6a9f14e76529d4b336d5972e01cfb932c63c0639 (patch) | |
tree | 7930310b9622ac568f147bebace23c8204199c25 | |
parent | 2eebf06ade7a316f057334dd6d76b6af22c8ff01 (diff) | |
download | red-black-tree-master.tar.gz red-black-tree-master.tar.bz2 red-black-tree-master.zip |
-rw-r--r-- | README.md | 30 |
1 files changed, 15 insertions, 15 deletions
@@ -44,7 +44,7 @@ is required for the final build of the executable file. Before using the functions, allocate dynamic memory in your program. ``` -rb_tree \*new_tree = malloc(sizeof(rb_tree)); +rb_tree *new_tree = malloc(sizeof(rb_tree)); ``` Do not forget to free the allocated memory at the end using: @@ -55,27 +55,27 @@ free(new_tree); ## Interface for managing rb-tree -1. *`void rb_tree_init(rb_tree \*t);`* +- *`void rb_tree_init(rb_tree *t);`* -To fill `new_tree` with initial values. + To fill `new_tree` with initial values. -2. *`node \*rb_tree_create_node(rb_tree \*t, int num);`* +- *`node *rb_tree_create_node(rb_tree *t, int num);`* -Returns a pointer of type `node\*` to the created node (note that the node has -not yet been inserted into the tree). Or NULL if the num value has already been -inserted into the tree. + Returns a pointer of type `node*` to the created node (note that the node has + not yet been inserted into the tree). Or NULL if the num value has already been + inserted into the tree. -3. *`void rb_tree_insert_node(rb_tree \*t, node \*cur_node);`* +- *`void rb_tree_insert_node(rb_tree *t, node *cur_node);`* -4. *`void rb_tree_delete_node(rb_tree \*t, node \*cur_node);`* +- *`void rb_tree_delete_node(rb_tree *t, node *cur_node);`* -5. *`void rb_tree_clear(rb_tree \*t, node \*root);`* +- *`void rb_tree_clear(rb_tree *t, node *root);`* -6. *`node\* rb_tree_search(rb_tree \*t, node \*root, int num);`* +- *`node *rb_tree_search(rb_tree *t, node *root, int num);`* -Returns a node of type `node\*`. If the value was not found into the tree, then the -node will be equal to `t->nil`, otherwise it returns the node with the required value. + Returns a node of type `node*`. If the value was not found into the tree, then the + node will be equal to `t->nil`, otherwise it returns the node with the required value. -7. `void rb_tree_print(rb_tree \*t, node \*root);` +- *`void rb_tree_print(rb_tree *t, node *root);`* -Displaying a binary tree in stdout. + Displaying a binary tree in stdout. |