-
0. New node: C function that creates a binary tree node with a given parent and value.
- Returns a pointer to the new node, or
NULL
on failure.
- Returns a pointer to the new node, or
-
1. Insert left: C function that inserts a node as the left-child of another.
- Returns a pointer to the new node, or
NULL
on failure. - If the given
parent
already contains a left node, the new node takes its place and the old left-child becomes the left-child of the new node.
- Returns a pointer to the new node, or
-
2. Insert right: C function that inserts a node as the right-child of another.
- Returns a pointer to the new node, or
NULL
on failure. - If the given
parent
already contains a right node, the new node takes its place and the old right-child becomes the right-child of the new node.
- Returns a pointer to the new node, or
-
3. Delete: C function that deletes an entire binary tree.
-
4. Is leaf: C function that checks if a given node is a leaf.
- Returns
1
if the node is a leaf,0
otherwise.
- Returns
-
5. Is root: C function that checks if a given node is a root.
- Returns
1
if the node is a root,0
otherwise.
- Returns
-
6. Pre-order traversal: C function that traverses a tree using pre-order traversal.
-
7. In-order traversal: C function that traverses a tree using in-order traversal.
-
8. Post-order traversal: C function that traverses a tree using post-order traversal.
-
9. Height: C function that returns the height of a binary tree.
-
10. Depth: C function that returns the depth of a given node in a binary tree.
-
11. Size: C function that returns the size of a binary tree.
-
12. Leaves: C function that returns the number of leaves in a binary tree.
-
13. Nodes: C function that returns the number of nodes in a binary tree with at least one child.
-
14. Balance factor: C function that returns the balance factor of a binary tree.
-
15. Is full: C function that checks if a binary tree is full.
- Returns
1
if a tree is full,0
otherwise.
- Returns
-
16. Is perfect: C function that checks if a binary tree is perfect.
- Returns
1
if a tree is perfect,0
otherwise.
- Returns
-
17. Sibling: C function that returns a pointer to the sibling of a given node in a binary tree.
- Returns
NULL
if no sibling is found.
- Returns
-
18. Uncle: C function that returns a pointer to the uncle of a given node in a binary tree.
- Returns
NULL
if no uncle is found.
- Returns
- Estephania Calvo Carvajal <EstephaniaCalvoC>