diff options
Diffstat (limited to 'collections/map/map.c')
-rw-r--r-- | collections/map/map.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/collections/map/map.c b/collections/map/map.c index b0e095e..d581d81 100644 --- a/collections/map/map.c +++ b/collections/map/map.c @@ -497,6 +497,30 @@ void *key; return ret; } +void* map_first(root) +map *root; +{ + struct map_node *tmp; + + if (!root) + return; + + for (tmp = root->root; tmp->left; tmp = tmp->left); + return tmp->val; +} + +void* map_last(root) +map *root; +{ + struct map_node *tmp; + + if (!(root || root->root)) + return; + + for (tmp = root->root; tmp->right; tmp = tmp->right); + return tmp->val; +} + void map_swap(root, ikey, jkey) map *root; void *ikey, *jkey; |