{"id":17062132,"url":"https://github.com/recp/ds","last_synced_at":"2025-08-02T13:43:16.934Z","repository":{"id":55906664,"uuid":"95283228","full_name":"recp/ds","owner":"recp","description":"🔗 Common Data Structures and Algorithms","archived":false,"fork":false,"pushed_at":"2023-09-14T19:11:57.000Z","size":104,"stargazers_count":50,"open_issues_count":0,"forks_count":5,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-10-15T10:49:16.455Z","etag":null,"topics":["algorithm","algorithms","algorithms-datastructures","balanced-search-trees","binary-search-tree","data-structure","forward-list","hash","hash-table","libds","list","octree","rbtree","red-black-tree","search-trees","tree"],"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/recp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-06-24T07:40:28.000Z","updated_at":"2024-07-02T16:46:33.000Z","dependencies_parsed_at":"2024-01-16T23:26:53.983Z","dependency_job_id":"f0d3d4c9-ce9c-488a-ac70-5a7ae6284b4f","html_url":"https://github.com/recp/ds","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recp%2Fds","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recp%2Fds/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recp%2Fds/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recp%2Fds/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/recp","download_url":"https://codeload.github.com/recp/ds/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221832163,"owners_count":16888184,"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":["algorithm","algorithms","algorithms-datastructures","balanced-search-trees","binary-search-tree","data-structure","forward-list","hash","hash-table","libds","list","octree","rbtree","red-black-tree","search-trees","tree"],"created_at":"2024-10-14T10:49:17.821Z","updated_at":"2024-10-28T13:29:52.326Z","avatar_url":"https://github.com/recp.png","language":"C","readme":"# 🔗 Data Structures and Algorithms\n\n[![Build Status](https://travis-ci.org/recp/ds.svg?branch=master)](https://travis-ci.org/recp/ds)\n[![Build status](https://ci.appveyor.com/api/projects/status/yqpyll64woh39a23/branch/master?svg=true)](https://ci.appveyor.com/project/recp/libds/branch/master)\n[![Coverage Status](https://coveralls.io/repos/github/recp/libds/badge.svg?branch=master)](https://coveralls.io/github/recp/libds?branch=master)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/50b73a3049b9497a97fe7468a9d79d08)](https://www.codacy.com/app/recp/libds?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=recp/libds\u0026amp;utm_campaign=Badge_Grade)\n\nThis library provides common data structures. It will also provide some data structures which needed in render or game engines. In the future I'll try to optimize memmory access. \n\nThere may multiple way to implement a data structure but I tried to implement best way to do that. For instance Red-Black Trees are only implemented as top down insertion/deletion to make it faster. \n\nThere are some convenient constructors for common use cases. For instance `rb_newtree_str()` creates new rb-tree that uses strings as key, `rb_newtree_ptr()` creates new rb-tree that uses pointers as key. When you use these functions to alloc a data structure then you don't need to provide compare or print functions. \n\nThis library prodives allocator api so you can override default allocator. \n\n## Usage\n\n```C\n#include \u003cds/rb.h\u003e // Red-Black Tree\n\nint\nmain(int argc, const char * argv[]) {\n  RBTree *tree;\n  /* ... */\n\n  /* use string keys */\n  tree = rb_newtree_str();\n\n  rb_insert(tree, \"key\", value);\n\n  /* ... */\n  value = rb_find(tree, \"key\");\n\n  rb_destroy(tree);\n}\n\n```\n\n## Todo\n- [x] rbtree\n   - [x] top-down insertion\n   - [x] top-down deletion\n- [x] forward-list\n  - [x] forward-list-separate (reduces FList struct)\n- [x] hash-table\n   - [x] builtin hash functions e.g. djb2\n   - [x] resizing hash table\n- [x] quick sort implementation for float, double, i32, u32, i64, u64\n- [ ] queue (working on this)\n- [ ] stack\n- [ ] binary heap / priority queue\n- [ ] dynamic array\n- [ ] octree\n- [ ] quadtree\n- [ ] kd-tree\n- [ ] bvh\n- [ ] b-tree\n\n## Build\n\n### Unix (Autotools)\n\n```bash\n$ sh autogen.sh\n$ ./configure\n$ make\n$ make check # [Optional]\n$ [sudo] make install # [Optional]\n```\n\n### Windows (MSBuild)\nWindows related build, project files are located in `win` folder,\nmake sure that you are inside in the `libds/win` folder.\nCode Analysis are enabled, it may take awhile to finish build\n\n```Powershell\n$ cd win\n$ .\\build.bat\n```\nif `msbuild` didn't work then you can try to build it with `devenv`:\n```Powershell\n$ devenv libds.sln /Build Release\n```\n\n## License\nMIT. check the LICENSE file\n","funding_links":[],"categories":["Data Structures","数据结构"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frecp%2Fds","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frecp%2Fds","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frecp%2Fds/lists"}