aboutsummaryrefslogtreecommitdiff
path: root/collections/map/map.c
diff options
context:
space:
mode:
Diffstat (limited to 'collections/map/map.c')
-rw-r--r--collections/map/map.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/collections/map/map.c b/collections/map/map.c
index 803b5ad..712a895 100644
--- a/collections/map/map.c
+++ b/collections/map/map.c
@@ -25,3 +25,12 @@ cmp_func cmp;
return tmp;
}
+
+int map_size(root)
+map *root;
+{
+ if (!root || !root->key)
+ return 0;
+
+ return map_size(root->left) + map_size(root->right) + 1;
+}