{"id":21182229,"url":"https://github.com/chscript/algorithmlib","last_synced_at":"2026-05-04T22:40:49.354Z","repository":{"id":65810167,"uuid":"600130793","full_name":"chscript/algorithmlib","owner":"chscript","description":"⚙️ Data Structure \u0026 Algorithm library written with Typescript","archived":false,"fork":false,"pushed_at":"2023-02-15T10:43:34.000Z","size":90,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-20T23:42:32.958Z","etag":null,"topics":["algorithm","commonjs","data-structure","esmodule","javascript","typescript"],"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/chscript.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,"zenodo":null}},"created_at":"2023-02-10T16:48:52.000Z","updated_at":"2023-03-04T05:29:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"cbd1328a-45f2-4af1-bd6c-5c6a1b452e06","html_url":"https://github.com/chscript/algorithmlib","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/chscript/algorithmlib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chscript%2Falgorithmlib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chscript%2Falgorithmlib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chscript%2Falgorithmlib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chscript%2Falgorithmlib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chscript","download_url":"https://codeload.github.com/chscript/algorithmlib/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chscript%2Falgorithmlib/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32628211,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-04T10:08:07.713Z","status":"ssl_error","status_checked_at":"2026-05-04T10:08:02.005Z","response_time":58,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["algorithm","commonjs","data-structure","esmodule","javascript","typescript"],"created_at":"2024-11-20T17:56:09.446Z","updated_at":"2026-05-04T22:40:49.348Z","avatar_url":"https://github.com/chscript.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eAlgorithmlib\u003c/h1\u003e\n\n\u003cp align=\"center\" \u003e\n\u003cimg  src=\"https://img.shields.io/badge/build-passing-brightgreen\" /\u003e\n\u003cimg  src=\"https://img.shields.io/badge/coverage-94%25-green\" /\u003e\n\u003cimg  src=\"https://img.shields.io/badge/npm-v2.0.4-blue\" /\u003e\n\u003cimg  src=\"https://img.shields.io/badge/cdnjs-v2.0.4-blue\" /\u003e\n\u003cimg  src=\"https://img.shields.io/badge/downloads-200+-brightgreen\" /\u003e\n\u003cimg  src=\"https://img.shields.io/badge/License-MIT-green\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/chscript/algorithmlib/blob/main/README_zh.md\"\u003e中文\u003c/a\u003e｜\n  \u003ca href=\"https://github.com/chscript/algorithmlib/blob/main/README.md\"\u003eEnglish\u003c/a\u003e\u003c/p\u003e\n\n## Overview\n\nAlgorithmlib is an algorithm library that supports Common. js and ES module syntax. It can be applied to Node.js projects or projects built through ES modules to reduce the time spent in handwriting data structures or algorithms in JavaScript or TypeScript projects.\n\n## Quick Start Guide\n\n### Install\n\n```shell\nnpm install algorithmlib\n```\n\n### Demo\n\n1. Import `Stack` through ES module syntax\n\n```javascript\nimport { Stack } from 'algorithmlib'\nlet a = new Stack()\na.push('element')\na.pop()\n```\n\n2. Import `Stack` through Common.js syntax\n\n```javascript\nconst { Stack } = require('algorithmlib')\nlet a = new Stack()\na.push('element')\na.pop()\n```\n\n3. Import `Stack` through `\u003cscript\u003e` tag\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n    \u003cmeta charset=\"UTF-8\"\u003e\n    \u003cmeta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"\u003e\n    \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"\u003e\n    \u003ctitle\u003eDocument\u003c/title\u003e\n    \u003cscript src=\"./node_modules/algorithmlib/dist/index.iife.js\"\u003e\u003c/script\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n    \u003cscript\u003e\n        const { Stack } = algorithmlib\n        let a = new Stack()\n        a.push('element')\n        a.pop()\n    \u003c/script\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n## API Reference\n\n**Stack\\\u003cT\u003e**\n\n- pop(): T | undefined\n- push(element: T): Stack\\\u003cT\u003e\n- isEmpty(): boolean\n\n**Queue\\\u003cT\u003e**\n\n- dequeue(): T | undefined\n- enqueue(element: T): Queue\\\u003cT\u003e\n- isEmpty(): boolean\n\n**LinkedList\\\u003cT\u003e**\n\n- indexOf(element: T): number\n- insert(element: T, index?: number): LinkedList\\\u003cT\u003e\n- remove(index: number): boolean\n- isEmpty(): boolean\n\n**HashTable\u003cK extends number | string, V\u003e**\n\n- get(key: K): V | undefined\n- set(key: K, value: V): HashTable\u003cK, V\u003e\n- remove(key: K): boolean\n- isEmpty(): boolean\n\n**BinarySearchTree\\\u003cT\u003e**\n\n- min():  BinarySearchTreeNode\\\u003cT\u003e | null\n- max():  BinarySearchTreeNode\\\u003cT\u003e | null\n- minNode(node:  BinarySearchTreeNode\\\u003cT\u003e | null):  BinarySearchTreeNode\\\u003cT\u003e | null\n- maxNode(node:  BinarySearchTreeNode\\\u003cT\u003e | null):  BinarySearchTreeNode\\\u003cT\u003e | null\n- insert(index: number, element: T): BinarySearchTree\\\u003cT\u003e\n- search(index: number): boolean\n- remove(index: number): boolean\n- isEmpty(): boolean\n\n**Binary Tree Traversal**\n\n- preOrderTraversal: \\\u003cT\u003e(tree: BinarySearchTree\\\u003cT\u003e) =\u003e { index: number; element: T }[]\n- postOrderTraversal: \\\u003cT\u003e(tree: BinarySearchTree\\\u003cT\u003e) =\u003e { index: number; element: T }[]\n- inOrderTraversal: \\\u003cT\u003e(tree: BinarySearchTree\\\u003cT\u003e) =\u003e { index: number; element: T }[]\n- levelOrderTraversal: \\\u003cT\u003e(tree: BinarySearchTree\\\u003cT\u003e) =\u003e { index: number; element: T }\\[][]\n\n**Graph\\\u003cK\u003e**\n\n- addVertex(...vertices: K[]): Graph\\\u003cK\u003e\n- addEdge(v: K, edges: Array\u003c[K, number | null]\u003e): Graph\\\u003cK\u003e\n- removeVertex(v: K): Graph\\\u003cK\u003e\n- removeEdge(v: K, w: K): Graph\\\u003cK\u003e\n\n**Graph Traversal**\n\n- breadthFirstSearch: \\\u003cK\u003e(graph: Graph\\\u003cK\u003e, startVertex: K) =\u003e K[]\n- depthFirstSearch: \\\u003cK\u003e(graph: Graph\\\u003cK\u003e, startVertex: K) =\u003e K[]\n\n**Sort Algorithm**\n\n- bubbleSort\\\u003cT\u003e: (array: T[], compare?: sortedCallbackFuction\\\u003cT\u003e) =\u003e T[];\n- insertSort\\\u003cT\u003e: (array: T[], compare?: sortedCallbackFuction\\\u003cT\u003e) =\u003e T[];\n- quickSort\\\u003cT\u003e: (array: T[], compare?: sortedCallbackFuction\\\u003cT\u003e) =\u003e T[];\n- mergeSort\\\u003cT\u003e: (array: T[], compare?: sortedCallbackFuction\\\u003cT\u003e) =\u003e T[];\n\n**Search Algorithm**\n\n- binarySearch\\\u003cT\u003e: (array: T[], target: number | { [key: string]: number }) =\u003e number | boolean\n\n## License\n\n[MIT](https://github.com/chscript/algorithmlib/blob/main/LICENSE)\n\nCopyright (c) 2023-present Steve Yang","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchscript%2Falgorithmlib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchscript%2Falgorithmlib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchscript%2Falgorithmlib/lists"}