An implementation of an AVL tree in c.
For demonstration purposes, this repo contains a test harness and a Makefile to compile and link the avl implementation and test harness. You can then execute the test harness with /.hc_avl_test
. This assumes an OS with make
and gcc
.
Initialize an AVL tree for usage.
Insert into the t
a node with key k
and value v
.
Traverse the given tree t
in the order indicated by order_flag
and print each node's key and value along the way.
Pass order_flag
as -1
to execute pre-order traversal.
Pass order_flag
as 0
to execute in-order traversal.
Pass order_flag
as 1
to execute post-order traversal.
Pass order_flag
as 2
to execute level-order (breadth-first) traversal.
Any other order_flag
value will result in in the function doing nothing.
Get the height of the given tree t
.
Deletes the node with key k
in the tree t
, if it exists.
Print the contents of the tree t
.
Destroy the given tree t
.