{"id":17899520,"url":"https://github.com/anupam-io/avl_tree","last_synced_at":"2025-04-03T05:24:06.492Z","repository":{"id":122494699,"uuid":"213611998","full_name":"anupam-io/avl_tree","owner":"anupam-io","description":"AVL tree: height-balanced trees in C supporting add, remove, search, update features. A comparison of AVL trees with red-black trees is also done(std::set).","archived":false,"fork":false,"pushed_at":"2020-12-12T15:40:11.000Z","size":130,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-08T19:27:51.038Z","etag":null,"topics":["avl-tree","avl-tree-code","avl-tree-implementations","bst","c","data-structures","height-balanced-trees","red-black-trees","rotations","std"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anupam-io.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":"2019-10-08T10:20:50.000Z","updated_at":"2021-03-24T15:03:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"e618b95d-fd41-4b26-9a5f-8fc92eeb6e44","html_url":"https://github.com/anupam-io/avl_tree","commit_stats":null,"previous_names":["anupam-io/avl_tree","akcgjc007/avl_tree"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anupam-io%2Favl_tree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anupam-io%2Favl_tree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anupam-io%2Favl_tree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anupam-io%2Favl_tree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anupam-io","download_url":"https://codeload.github.com/anupam-io/avl_tree/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246940563,"owners_count":20858158,"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":["avl-tree","avl-tree-code","avl-tree-implementations","bst","c","data-structures","height-balanced-trees","red-black-trees","rotations","std"],"created_at":"2024-10-28T15:59:46.684Z","updated_at":"2025-04-03T05:24:06.456Z","avatar_url":"https://github.com/anupam-io.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AVL Trees: perfectly balanced, as all things should be\n\n## Introduction\n[AVL trees](https://en.wikipedia.org/wiki/AVL_tree)(named after inventors Adelson-Velsky and Landis), also known as height-balanced trees are a widely-used data structure when it comes to efficient read, write and search operations. \n\nSimilar to a [BST(binary search tree)](https://en.wikipedia.org/wiki/Binary_search_tree), an AVL tree also has basic operations:\n - add()\n - remove()\n - search()\n\nBut what makes an AVL tree efficient and fast\n - always height balanced\n   - balance factor on any node is 0 or 1\n - always achieves minimum height\n   - by [rotations](https://en.wikipedia.org/wiki/Tree_rotation)\n\n## How is it perfect balanced\nAt the time of insertions and deletions:\n - it finds the first node where one side becomes more heavy than the other\n - fix this by RR, RL, LR, LL rotations\n - the whole tree is balanced\n\n## Comparision with RB trees\nI have compared my implementation with the [std::set](http://www.cplusplus.com/reference/set/set/)(implemented with [red-black trees](https://en.wikipedia.org/wiki/Red%E2%80%93black_tree)) for different workloads.\nHere are the results:\n\n\u003cimg src=\"plots/graph.png\" alt=\"comparison\" width=\"400\"/\u003e\n\n## How to use ?\n - defining an instance of avl tree:\n   - `tree* my_tree = new_tree();`\n - adding an element:\n   - `add_t(my_tree, 77);`\n - removing an element:\n   - `remove_t(my_tree, 67);`\n - searching for an element:\n   - `find_t(my_tree, 57);`\n - deleting the instance of tree:\n   - `delete_tree(my_tree);`\n   \n## Contributors\n\u003ctable\u003e\u003ctr\u003e\u003ctd align=\"center\"\u003e\n        \u003ca href=\"https://github.com/akcgjc007\"\u003e\n            \u003cimg src=\"https://avatars2.githubusercontent.com/u/56300182\" width=\"100;\" alt=\"anupam\"/\u003e\n            \u003cbr /\u003e\n            \u003csub\u003e\u003cb\u003eAnupam Kumar\u003c/b\u003e\u003c/sub\u003e\n        \u003c/a\u003e\n    \u003c/td\u003e\u003c/tr\u003e\n\u003c/table\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanupam-io%2Favl_tree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanupam-io%2Favl_tree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanupam-io%2Favl_tree/lists"}