{"id":19362685,"url":"https://github.com/svandriel/quick-avl","last_synced_at":"2026-05-14T18:05:21.083Z","repository":{"id":37932731,"uuid":"375939792","full_name":"svandriel/quick-avl","owner":"svandriel","description":"A Typescript implementation of an AVL tree, which is a self-balancing binary search tree.","archived":false,"fork":false,"pushed_at":"2023-05-04T19:39:04.000Z","size":1184,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-21T00:55:51.232Z","etag":null,"topics":["avl","bst","self-balancing-binary-search-tree"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/svandriel.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":"2021-06-11T07:23:27.000Z","updated_at":"2022-05-20T12:34:40.000Z","dependencies_parsed_at":"2024-11-10T07:30:13.405Z","dependency_job_id":null,"html_url":"https://github.com/svandriel/quick-avl","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/svandriel/quick-avl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svandriel%2Fquick-avl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svandriel%2Fquick-avl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svandriel%2Fquick-avl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svandriel%2Fquick-avl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/svandriel","download_url":"https://codeload.github.com/svandriel/quick-avl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svandriel%2Fquick-avl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33037064,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-14T02:00:06.663Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","bst","self-balancing-binary-search-tree"],"created_at":"2024-11-10T07:29:54.846Z","updated_at":"2026-05-14T18:05:21.068Z","avatar_url":"https://github.com/svandriel.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# quick-avl\n\nA Typescript implementation of an AVL tree, which is a self-balancing binary search tree.\n\nImplements the Map interface.\n\nNamed after the inventors [Adelson-Velsky and Landis](https://en.wikipedia.org/wiki/AVL_tree), an AVL tree enforces an invariant where the heights of the subtrees of a node differ by at most one. Rebalancing is performed after each insert or remove operation, if that operation made the tree imbalanced.\n\n## Installation\n\n```\nnpm install quick-avl\n```\n\n## Performance\n\nThe main reason of using an AVL tree is performance. Because of its self-balancing property, worst case lookup is _O(log(n))_, compared to the plain binary search trees where this is _O(n)_.\n\n| Operation | Average time complexity | Worst case complexity |\n| --------- | ----------------------- | --------------------- |\n| find      | _O(log n)_              | _O(log n)_            |\n| insert    | _O(log n)_              | _O(log n)_            |\n| remove    | _O(log n)_              | _O(log n)_            |\n| traversal | _O(n)_                  | _O(n)_                |\n\n## Usage\n\nThis AVL tree implementation acts like a map to store key-value pairs in.\n\n```typescript\nimport { AvlTree } from 'quick-avl';\n\nconst users = new AvlTree\u003cnumber, string\u003e();\n\nusers.set(100, 'Bob').set(200, 'Carol').set(0, 'Alice');\n\nusers.get(100); // --\u003e 'Bob'\nusers.has(100); // --\u003e true\n\nusers.delete(200); // --\u003e true\n\nusers.valueList(); // --\u003e ['Alice', 'Carol']\n\nfor (const [key, value] of users) {\n  console.log(`Key: ${key}, value: ${value}`);\n}\n```\n\n## Why another AVL library\n\nWhile there are some excellent AVL libraries available within NPM, these libraries swap out tree node values while performing tree balancing. I required an AVL library that does not replace keys or values within a node. That way, a reference to a tree node will always keep the same value.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsvandriel%2Fquick-avl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsvandriel%2Fquick-avl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsvandriel%2Fquick-avl/lists"}