{"id":24772503,"url":"https://github.com/theo-mestre/interval-map","last_synced_at":"2025-03-23T20:44:59.114Z","repository":{"id":273995809,"uuid":"921573081","full_name":"Theo-Mestre/Interval-map","owner":"Theo-Mestre","description":"An interval_map implementation I did as part of a programming test","archived":false,"fork":false,"pushed_at":"2025-01-28T16:09:10.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-23T20:44:53.631Z","etag":null,"topics":["container","cpp","stl"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Theo-Mestre.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-24T07:47:13.000Z","updated_at":"2025-01-28T16:09:27.000Z","dependencies_parsed_at":"2025-01-24T08:39:50.920Z","dependency_job_id":null,"html_url":"https://github.com/Theo-Mestre/Interval-map","commit_stats":null,"previous_names":["theo-mestre/interval-map"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Theo-Mestre%2FInterval-map","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Theo-Mestre%2FInterval-map/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Theo-Mestre%2FInterval-map/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Theo-Mestre%2FInterval-map/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Theo-Mestre","download_url":"https://codeload.github.com/Theo-Mestre/Interval-map/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245168814,"owners_count":20571799,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["container","cpp","stl"],"created_at":"2025-01-29T04:23:10.957Z","updated_at":"2025-03-23T20:44:59.086Z","avatar_url":"https://github.com/Theo-Mestre.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Interval Map Implementation\n\nThis repository contains an implementation of an `interval_map` in C++ designed for managing intervals and their associated values. The class allows you to assign values to specified intervals and perform efficient lookups, adhering to the C++ Standard Library conventions.\n\n## Features\n- Assign a value to an interval `[keyBegin, keyEnd)`.\n- Efficient lookup of values associated with keys.\n- Handles overlapping, contiguous, and redundant interval assignments.\n- Includes a test function to validate core functionality.\n\n### Template Parameters\n- `K`: The type of the keys representing the interval boundaries.\n- `V`: The type of the values associated with the intervals.\n\n### Key Methods\n- **assign**: Assigns a value to a specified interval, overwriting any previous values.\n  ```cpp\n  template\u003ctypename V_forward\u003e\n  void assign(K const\u0026 keyBegin, K const\u0026 keyEnd, V_forward\u0026\u0026 val);\n  ```\n\n- **operator[]**: Retrieves the value associated with a key.\n  ```cpp\n  const V\u0026 operator[](K const\u0026 key) const;\n  ```\n### Complexity\nThe time complexity of key operations in interval_map is logarithmic (O(log n) where n is the number of elements in the map). \n\n## Example Usage\nHere's a simple example of using the `interval_map` class:\n\n```cpp\n#include \"interval_map.h\"\n\nint main() {\n    interval_map\u003cint, char\u003e imap('A');\n\n    // Assign values to intervals\n    imap.assign(5, 10, 'B');\n    imap.assign(7, 12, 'C');\n    imap.assign(12, 15, 'D');\n\n    // Perform lookups\n    std::cout \u003c\u003c \"Value at key 6: \" \u003c\u003c imap[6] \u003c\u003c std::endl; // Outputs 'B'\n    std::cout \u003c\u003c \"Value at key 10: \" \u003c\u003c imap[10] \u003c\u003c std::endl; // Outputs 'C'\n\n    return 0;\n}\n```\n\n## License\nThis project is licensed under the MIT License.\n\n## Acknowledgments\nInspired by coding exercises I did in school and C++, focused on interval management programming best practices.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheo-mestre%2Finterval-map","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheo-mestre%2Finterval-map","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheo-mestre%2Finterval-map/lists"}