{"id":24538892,"url":"https://github.com/valinsogna/c-_rbt_project","last_synced_at":"2025-10-03T16:36:40.705Z","repository":{"id":176869504,"uuid":"535012594","full_name":"valinsogna/c-_rbt_project","owner":"valinsogna","description":"Implementation of Red-Black Tree class in C++","archived":false,"fork":false,"pushed_at":"2022-09-24T11:11:12.000Z","size":320,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T15:36:40.648Z","etag":null,"topics":["cpp","red-black-tree","templates"],"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/valinsogna.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2022-09-10T13:51:46.000Z","updated_at":"2023-09-19T14:02:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"0a2dd705-7712-4d76-808e-f20c20ca91fa","html_url":"https://github.com/valinsogna/c-_rbt_project","commit_stats":null,"previous_names":["valinsogna/c-_rbt_project"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valinsogna%2Fc-_rbt_project","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valinsogna%2Fc-_rbt_project/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valinsogna%2Fc-_rbt_project/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valinsogna%2Fc-_rbt_project/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/valinsogna","download_url":"https://codeload.github.com/valinsogna/c-_rbt_project/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243817896,"owners_count":20352626,"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":["cpp","red-black-tree","templates"],"created_at":"2025-01-22T15:29:25.864Z","updated_at":"2025-10-03T16:36:40.606Z","avatar_url":"https://github.com/valinsogna.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Red-Black Tree in c++\n\u003c!-- PROJECT SHIELDS --\u003e\n\u003c!--\n*** I'm using markdown \"reference style\" links for readability.\n*** Reference links are enclosed in brackets [ ] instead of parentheses ( ).\n*** See the bottom of this document for the declaration of the reference variables\n*** for contributors-url, forks-url, etc. This is an optional, concise syntax you may use.\n*** https://www.markdownguide.org/basic-syntax/#reference-style-links\n--\u003e\n[![Contributors][contributors-shield]][contributors-url]\n[![Forks][forks-shield]][forks-url]\n[![Stargazers][stars-shield]][stars-url]\n[![Issues][issues-shield]][issues-url]\n[![MIT License][license-shield]][license-url]\n\nImplementation of Red-Black Tree class and its iterator in c++\n\n## Compile and Run\n\n- to compile type command `make`\n- to run type command `./RBTree.x`\n- to delete executable type command `make clean`\n\n## Repository structure\nYou will find the implementation of the class Red-Black Tree and its iterator inside file `RBTree.cpp` along with a test inside the main. \n\n## Introduction\nRed-Black Trees are binary search trees satisfying the following conditions:\n- every node is either red or black;\n- the root is black\n- every leaf (NIL) is black;\n- if a node is red, then its children are black;\n- for each node x, all the simple paths from x to descendant leaves contains the same number of black nodes.\n\nThanks to the mentioned properties, it is possible to insert, delete, and\nsearch a value in a red-black tree in time O(log n) (e.g., see [1]).\n\n## Implementation\n\nImplement the generic classes:\n- `RBTree\u003cT, CMP=std::less\u003cT\u003e\u003e` to represent red-black trees.\n- ` RBTree\u003cT, CMP=std::less\u003cT\u003e\u003e::const` to represent red-black trees constant iterators.\n\nconst iterator must provide the following public methods:\n- `const T\u0026 operator*() const` to get the value associated to the iterator;\n- `const T* operator-\u003e() const` to access to the value associated to the iterator;\n- `const_iterator\u0026 operator++()` to pre-increment the iterator;\n- `const_iterator operator++(int)` to post-increment the iterator;\n- `bool operator==(const const_iterator\u0026) const` to test whether two iterators are equivalent;\n- `bool operator!=(const const_iterator\u0026) const` to test whether two iterators are different.\n\nMoreover, RBTree must provide the following public methods:\n- `void insert(const T\u0026 value)` to insert a new value in the tree;\n- `bool contains(const T\u0026 value) const` to test whether the tree con- tains a value;\n- `bool delete(const T\u0026 value)` to delete a value from the tree;\n- `RBTree\u003cT, CMP\u003e::const_iterator begin() const` to get a constant tree iterator over all the tree keys;\n- `RBTree\u003cT, CMP\u003e::const_iterator end() const` to get the last value for a tree iterator. \n\nFew functions showing the classes features are also requested (e.g., by using the Boost test library).\n\n## References\n[1]: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein. Introduction to Algorithms. The MIT Press, 2nd edition, 2001\n\n\u003c!-- MARKDOWN LINKS \u0026 IMAGES --\u003e\n\n[contributors-shield]: https://img.shields.io/github/contributors/valinsogna/c-_rbt_project.svg?style=for-the-badge\n\n[contributors-url]: https://github.com/valinsogna/c-_rbt_project/graphs/contributors\n\n[forks-shield]: https://img.shields.io/github/forks/valinsogna/c-_rbt_project.svg?style=for-the-badge\n\n[forks-url]: https://github.com/valinsogna/c-_rbt_project/network/members\n\n[stars-shield]: https://img.shields.io/github/stars/valinsogna/c-_rbt_project.svg?style=for-the-badge\n\n[stars-url]: https://github.com/valinsogna/c-_rbt_project/stargazers\n\n[issues-shield]: https://img.shields.io/github/issues/valinsogna/c-_rbt_project.svg?style=for-the-badge\n\n[issues-url]: https://github.com/valinsogna/c-_rbt_project/issues\n\n[license-shield]: https://img.shields.io/github/license/valinsogna/c-_rbt_project.svg?style=for-the-badge\n\n[license-url]: https://github.com/valinsogna/c-_rbt_project/blob/main/LICENSE","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalinsogna%2Fc-_rbt_project","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvalinsogna%2Fc-_rbt_project","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalinsogna%2Fc-_rbt_project/lists"}