diff options
Diffstat (limited to 'collections/map')
| -rw-r--r-- | collections/map/map.c | 14 | 
1 files changed, 14 insertions, 0 deletions
| diff --git a/collections/map/map.c b/collections/map/map.c index a476a97..f61e8ef 100644 --- a/collections/map/map.c +++ b/collections/map/map.c @@ -12,6 +12,20 @@ struct map_node {  	struct map_node *left, *right, *parent;  }; +int map_height(root) +map *root; +{ +	int l, r; + +	if (!root || !root->key) +		return 0; + +	l = map_height(root->left); +	r = map_height(root->right); + +	return 1 + ( l > r ? l : r); +} +  map* map_new(cmp)  cmp_func cmp;  { | 
