{"id":15337277,"url":"https://github.com/vy/avl-tree","last_synced_at":"2025-10-16T13:30:40.061Z","repository":{"id":542038,"uuid":"171936","full_name":"vy/avl-tree","owner":"vy","description":"An AVL-Tree data structure implementation in Common Lisp.","archived":false,"fork":false,"pushed_at":"2013-04-12T07:02:27.000Z","size":112,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-12-06T15:22:08.250Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Common Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"ccovey/ldap-auth","license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vy.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}},"created_at":"2009-04-09T14:21:46.000Z","updated_at":"2024-03-23T16:16:34.000Z","dependencies_parsed_at":"2022-07-07T14:10:21.517Z","dependency_job_id":null,"html_url":"https://github.com/vy/avl-tree","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vy%2Favl-tree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vy%2Favl-tree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vy%2Favl-tree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vy%2Favl-tree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vy","download_url":"https://codeload.github.com/vy/avl-tree/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236721592,"owners_count":19194455,"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":[],"created_at":"2024-10-01T10:20:24.207Z","updated_at":"2025-10-16T13:30:34.757Z","avatar_url":"https://github.com/vy.png","language":"Common Lisp","funding_links":[],"categories":[],"sub_categories":[],"readme":"         T   ##%## #% %%#~        AVL (Adelson-Velsky-Landis) Tree is a\n       /   \\   ##%## ##% %#~      self-balancing binary search tree\n      V     E ###% %##~           implementation in Common Lisp.\n     / \\   / \\  #####%## ##~\n    A   L R   E  ####% %#% %#%%#~\n\n# Installation\n\nIt's quite simple to install `AVL-TREE` via `ASDF`. (See [`ASDF`](http://cliki.net/ASDF) for more information and check if your Common Lisp implementation bundled with ASDF support.) For instance, in SBCL, you'll need to type\n\n    CL-USER\u003e (require :asdf)\n    NIL\n    CL-USER\u003e (require :asdf-install)\n    NIL\n    CL-USER\u003e (asdf-install:install :avl-tree)\n    ...\n\n`ASDF-INSTALL` will handle dependencies for you. In case of manual installation, you'll need to get `DEMACS` package to be able to install `AVL-TREE`.\n\nAfter a successfull `ASDF-INSTALL`, you'll probably want to check the integrity of the supplied API functions. For this purpose, you can run test suits:\n\n    CL-USER\u003e (asdf:oos 'asdf:load-op :avl-tree)\n    ...\n    CL-USER\u003e (avl-tree:run-test-suite)\n    ...\n\n# Documentation\n\nAlthough the source code is quite well documented, below you can find a brief explanation of the exported functions \u0026 symbols by `AVL-TREE` package.\n\n## Specials\n\n    BRANCH-TERMINATOR+ [CONSTANT]\n\n\u003e Terminator to end branch pointers.\n\n    DUPLICATE-KEY [CONDITION]\n\n\u003e Raised as an error when a node with an existing key tried to be inserted into a tree.\n\u003e Accessors: `NODE-OF`\n\n    TREE-NODE-HEIGHT-TYPE [TYPE]\n\n\u003e Data type to represent height of a `TREE-NODE`.\n\n    TREE-NODE [CLASS]\n\n\u003e Data component for node related data storage.\n\u003e Accessors: `KEY-OF`, `DATA-OF`, `HEIGHT-OF`, `LBRANCH-OF`, `RBRANCH-OF`\n\n    TREE-ROOT [CLASS]\n\n\u003e Data component for tree related data storage.\n\u003e Accessors: `EQ-P-OF`, `LT-P-OF`, `NODE-OF`\n\n## Utilities\n\n    DUMP-BRANCH (BRANCH) [FUNCTION]\n\n\u003e Dumps branch recursively in a (relatively) human-readable form.\n\n    DUMP-TREE (ROOT) [FUNCTION]\n\n\u003e Dumps tree pointed by `ROOT` recursively in a (relatively) human-readable form.\n\n    EXPORT-BRANCH-TO-SEXP (BRANCH) [FUNCTION]\n\n\u003e Exports data collected in the nodes of the supplied `BRANCH` into `IMPORT-BRANCH-FROM-SEXP` parseable s-expression forms.\n\n    IMPORT-BRANCH-FROM-SEXP (SEXP) [FUNCTION]\n\n\u003e Imports data supplied in s-expression forms into suitable `TREE-NODE` structures.\n\n    TREE-BRANCH-P (BRANCH) [FUNCTION]\n\n\u003e Returns `NIL` if supplied `BRANCH` is not empty.\n\n    TREE-EMPTY-P (ROOT) [FUNCTION]\n\n\u003e Returns `NIL` if tree pointed by `ROOT` is not empty.\n\n    VALIDATE-BALANCE (ROOT) [FUNCTION]\n\n\u003e Validates balance of the nodes collected under the tree pointed by `ROOT`.\n\n    VALIDATE-BRANCH-BALANCE (BRANCH) [FUNCTION]\n\n\u003e Validates balance of the nodes collected under the supplied `BRANCH`.\n\n## Tree Routines\n\n    FIND-NODE (ROOT KEY \u0026KEY DEFAULT KEY-EQ-P KEY-LT-P) [FUNCTION]\n    \n\u003e Returns `TREE-NODE` paired with supplied `KEY` in the tree pointed by `ROOT`. If no such node is found, `DEFAULT` is returned.\n\n    INSERT-NODE (ROOT KEY DATA \u0026KEY KEY-EQ-P KEY-LT-P) [FUNCTION]\n\n\u003e Inserts a fresh `TREE-NODE` using supplied `KEY` and `DATA` into the tree pointed by `ROOT` node. Finally function returns `ROOT`.\n\n    REMOVE-NODE (ROOT KEY \u0026KEY KEY-EQ-P KEY-LT-P) [FUNCTION]\n\n\u003e Removes `TREE-NODE` paired with supplied `KEY` nested under tree pointed by given `ROOT`. Finally function returns `ROOT`.\n\n## Test Routines\n\n    RUN-TEST-SUITE () [FUNCTION]\n\n\u003e Runs available test suite and reports success-failure statistics.\n\n\n# Example Usage\n\nHere is a small demonstration of the `AVL-TREE`.\n\n    CL-USER\u003e (asdf:oos 'asdf:load-op :avl-tree)\n    ...\n    CL-USER\u003e (defpackage :test (:use :cl :avl-tree))\n    #\u003cPACKAGE \"TEST\"\u003e\n\n    CL-USER\u003e (in-package :test)\n    #\u003cPACKAGE \"TEST\"\u003e\n\n    TEST\u003e (defparameter *root* (make-instance 'tree-root :eq-p #'= :lt-p #'\u003c))\n    *ROOT*\n\n    TEST\u003e (dotimes (i 10)\n            (insert-node *root* i (code-char (+ #.(char-code #\\a) i))))\n    NIL\n\n    TEST\u003e (dump-tree *root*)\n    EQ-P: #\u003cFUNCTION (SB-C::\u0026OPTIONAL-DISPATCH =) {1000FF1469}\u003e\n    LT-P: #\u003cFUNCTION (SB-C::\u0026OPTIONAL-DISPATCH \u003c) {1000B80C19}\u003e\n    \n        #\u003cTREE-NODE :KEY 0 :HEIGHT 1 {10037C2391}\u003e\n      #\u003cTREE-NODE :KEY 1 :HEIGHT 2 {10037C3111}\u003e\n        #\u003cTREE-NODE :KEY 2 :HEIGHT 1 {10037C5091}\u003e\n    #\u003cTREE-NODE :KEY 3 :HEIGHT 4 {10037C5271}\u003e\n          #\u003cTREE-NODE :KEY 4 :HEIGHT 1 {10037C53F1}\u003e\n        #\u003cTREE-NODE :KEY 5 :HEIGHT 2 {10037C56C1}\u003e\n          #\u003cTREE-NODE :KEY 6 :HEIGHT 1 {10037C5A81}\u003e\n      #\u003cTREE-NODE :KEY 7 :HEIGHT 3 {10037C5DB1}\u003e\n        #\u003cTREE-NODE :KEY 8 :HEIGHT 2 {10037C60B1}\u003e\n          #\u003cTREE-NODE :KEY 9 :HEIGHT 1 {10037C6531}\u003e\n    NIL\n\n    TEST\u003e (data-of (find-node *root* 3))\n    #\\d\n\n    TEST\u003e (remove-node *root* 3)\n    #\u003cTREE-ROOT \n      :EQ-P #\u003cFUNCTION (SB-C::\u0026OPTIONAL-DISPATCH =) {1000FF1469}\u003e\n      :LT-P #\u003cFUNCTION (SB-C::\u0026OPTIONAL-DISPATCH \u003c) {1000B80C19}\u003e\n      :NODE #\u003cTREE-NODE :KEY 2 :HEIGHT 4 {1002534C11}\u003e {1002FDE861}\u003e\n\n    TEST\u003e (dump-tree *root*)\n    EQ-P: #\u003cFUNCTION (SB-C::\u0026OPTIONAL-DISPATCH =) {1000FF1469}\u003e\n    LT-P: #\u003cFUNCTION (SB-C::\u0026OPTIONAL-DISPATCH \u003c) {1000B80C19}\u003e\n    \n        #\u003cTREE-NODE :KEY 0 :HEIGHT 1 {1002504B81}\u003e\n      #\u003cTREE-NODE :KEY 1 :HEIGHT 2 {1002505901}\u003e\n    #\u003cTREE-NODE :KEY 2 :HEIGHT 4 {1002534C11}\u003e\n          #\u003cTREE-NODE :KEY 4 :HEIGHT 1 {100267FC81}\u003e\n        #\u003cTREE-NODE :KEY 5 :HEIGHT 2 {10027B2511}\u003e\n          #\u003cTREE-NODE :KEY 6 :HEIGHT 1 {1002960B61}\u003e\n      #\u003cTREE-NODE :KEY 7 :HEIGHT 3 {1002AB5C11}\u003e\n        #\u003cTREE-NODE :KEY 8 :HEIGHT 2 {1002BEB201}\u003e\n          #\u003cTREE-NODE :KEY 9 :HEIGHT 1 {1002DD59C1}\u003e\n    NIL\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvy%2Favl-tree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvy%2Favl-tree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvy%2Favl-tree/lists"}