{"id":17912126,"url":"https://github.com/jarun/dslib","last_synced_at":"2025-09-21T23:33:46.597Z","repository":{"id":93339578,"uuid":"40663607","full_name":"jarun/dslib","owner":"jarun","description":":herb: A library of \"connected\" data structures","archived":false,"fork":false,"pushed_at":"2023-09-10T04:45:40.000Z","size":156,"stargazers_count":127,"open_issues_count":0,"forks_count":22,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-12-30T19:42:53.818Z","etag":null,"topics":["academic","algorithm","avl","data-structures","dlist","stack","tree"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jarun.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":"jarun"}},"created_at":"2015-08-13T14:36:48.000Z","updated_at":"2024-12-25T05:33:01.000Z","dependencies_parsed_at":"2023-03-07T09:30:29.720Z","dependency_job_id":"9a51e6e6-99d7-4e58-bec7-647554ae2ed2","html_url":"https://github.com/jarun/dslib","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/jarun%2Fdslib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jarun%2Fdslib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jarun%2Fdslib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jarun%2Fdslib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jarun","download_url":"https://codeload.github.com/jarun/dslib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233808779,"owners_count":18733600,"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":["academic","algorithm","avl","data-structures","dlist","stack","tree"],"created_at":"2024-10-28T19:43:19.107Z","updated_at":"2025-09-21T23:33:41.287Z","avatar_url":"https://github.com/jarun.png","language":"C","funding_links":["https://github.com/sponsors/jarun","https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=RMLTQ76JSXJ4Q"],"categories":[],"sub_categories":[],"readme":"# dslib\n`dslib` is a library of cohesive data structures. The goal of `dslib` is to demonstrate how complex data structures (and related algorithms) can be developed by reusing simpler ones. In general, textbooks come with numerous unrelated examples, each relevant to a specific data structure. `dslib`, on the other hand, grows by building on the elementary data structures.\n\nThe core component is a circular doubly linked list. Library-internal data structures are dynamically (de)allocated.\n\nMost of the code conforms to the Linux kernel coding standards (verified against *checkpatch.pl*), other than a few unavoidable instances.\n\n`dslib` is an academic library. However, we'll be glad if someone finds any other application of it.\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=RMLTQ76JSXJ4Q\"\u003e\u003cimg src=\"https://img.shields.io/badge/PayPal-donate-1eb0fc.svg\" alt=\"Donate via PayPal!\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n### Table of Contents\n- [Building blocks](#building-blocks)\n- [APIs](#apis)\n- [Thread-safety](#thread-safety)\n- [Compilation](#compilation)\n- [Testing](#testing)\n- [Developers](#developers)\n- [Contributions](#contributions)\n\n### Building blocks\n| DS | Description |\n| --- | --- |\n| dlist | Circular doubly linked list. Node has next, prev and data (`void *`, caller (de)allocates) pointers. |\n| queue | Builds on top of dlist. Each element is a dlist node pointing to the value inserted in the queue. |\n| stack | Builds on top of dlist. Each element is a dlist node pointing to the value pushed in the stack. |\n| tree | A binary search tree, stores integers. |\n| AVL | An AVL tree implementation, stores integers. |\n| BFS | Iterative Breadth-first search for tree and AVL implemented using the queue. |\n| DFS | Iterative Depth-first search for tree implemented using the stack. |\n\nThere are test cases for each DS. Though not very organized, they provide an insight into the usage of `dslib`.\n\n### APIs\nA complete list of APIs can be found in [apilist.txt](https://github.com/jarun/dslib/blob/master/apilist.txt). Most of the APIs are iterative.\nThe following 2 APIs are recursive and the iterative implementations are left as an exercise:\n\n```\nbool delete_tree_node(tree_pp head, int val);\nbool delete_avl_node(avl_pp head, int val);\n```\n\n### Thread-safety\nCurrently the Thread-Safe mode is implemented only for AVL. The lock functions are in common.h and common.c and it's easy to extend thread-safety in other structures.\n\n### Compilation\nThe following compilation steps are tested on Ubuntu 14.04.4 x86_64:\n\n    $ git clone https://github.com/jarun/dslib/\n    $ cd dslib\n    $ make\n\nTo install `dslib`, run:\n\n    $ sudo make install\n\nTo remove `dslib` from your system, run:\n\n    $ sudo make uninstall\n\nClean up (cleans test executables too):\n\n    $ make clean\n\n### Testing\nMake sure `dslib` is installed. To compile test cases under `test` subdirectory:\n\n    $ sudo make install\n    $ make test\n\nOnly informative logs are enabled. For DEBUG logs, set:\n\n    int current_log_level = DEBUG;\n\nin the source test file.\n\n### Developers\n- [Arun Prakash Jana](https://github.com/jarun) (Copyright © 2015)\n- [Ananya Jana](https://github.com/ananyajana)\n\n### Contributions\nContributions are welcome! We would love to see more data structures and APIs added to `dslib`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjarun%2Fdslib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjarun%2Fdslib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjarun%2Fdslib/lists"}