Skip to content

Implemented an Ordered Map in C++ without using any inbuilt data structure.

Notifications You must be signed in to change notification settings

somyalalwani/Ordered-Map

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

Data Structures & Algorithms for Problem Solving

Problem : Ordered Map

Task : Implement an Ordered Map which supports the given operations

Operations:

1. insert(key, value) – Insert the key value pair. If the key is already present, update it’s current value. [O(log n)]
2. erase(key) – Erase the given key from the map if it is present.[O(log n)]
3. find(key) – returns true if key was found else return 0. [O(logn)]
4. map_obj[key] (subscript operator) – Access the element with the given key(if it is present in the map). Also, you should be able to modify the value at this key using this operator. If the value is not present, then insert this key with it’s corresponding assigned value. [O(log n)]
5. size() – returns the number of keys present in the Map. [O(1)]
6. clear() – removes all the elements from the Map. [O(n)]

Note: : Duplicates are not allowed. No inbuilt functions used.

About

Implemented an Ordered Map in C++ without using any inbuilt data structure.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages