{"id":19356438,"url":"https://github.com/haizlin/data-structures","last_synced_at":"2025-11-17T02:03:39.199Z","repository":{"id":71919933,"uuid":"103072443","full_name":"haizlin/data-structures","owner":"haizlin","description":"javascript/nodejs 数据结构","archived":false,"fork":false,"pushed_at":"2020-06-04T02:39:20.000Z","size":6,"stargazers_count":1,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-29T06:50:31.110Z","etag":null,"topics":["data-structures","datastructures","javascript"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/haizlin.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":"2017-09-11T00:37:39.000Z","updated_at":"2023-07-08T07:16:54.000Z","dependencies_parsed_at":"2023-06-17T12:00:33.522Z","dependency_job_id":null,"html_url":"https://github.com/haizlin/data-structures","commit_stats":{"total_commits":6,"total_committers":2,"mean_commits":3.0,"dds":"0.16666666666666663","last_synced_commit":"e49d46a83df46c2a458262b7a1947125bb9df4a7"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/haizlin/data-structures","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haizlin%2Fdata-structures","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haizlin%2Fdata-structures/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haizlin%2Fdata-structures/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haizlin%2Fdata-structures/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/haizlin","download_url":"https://codeload.github.com/haizlin/data-structures/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haizlin%2Fdata-structures/sbom","scorecard":{"id":453115,"data":{"date":"2025-08-11","repo":{"name":"github.com/haizlin/data-structures","commit":"e49d46a83df46c2a458262b7a1947125bb9df4a7"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/6 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-19T08:43:07.579Z","repository_id":71919933,"created_at":"2025-08-19T08:43:07.579Z","updated_at":"2025-08-19T08:43:07.579Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284807785,"owners_count":27066464,"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","status":"online","status_checked_at":"2025-11-17T02:00:06.431Z","response_time":55,"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":["data-structures","datastructures","javascript"],"created_at":"2024-11-10T07:04:29.102Z","updated_at":"2025-11-17T02:03:39.182Z","avatar_url":"https://github.com/haizlin.png","language":"JavaScript","readme":"# 数据结构\n\u003e 数据结构分为逻辑结构和存储结构两种。  \n\n所有代码都经过具体测试运行，具体环境为：\n- Javascript执行环境： Nodejs 8.0\n\n## 目录\n* [数组](#array)\n* [栈](#stack)\n* [队列](#queue)\n* [散列表](#hash)\n* [链表](#chain)\n* [集合](#set)\n* [树](#tree)\n* [堆](#heap)\n* [图](#graph)\n\n## 使用\n```Javascript\nnpm install hzl-data-structures\n```\n\n## 列表 \u003cspan id=\"list\"\u003e\u003c/span\u003e\n列表是非常常见的一种数据结构，比如日常所见的购物清单、待办事项等等。\n它提供了对列表数据的一系列操作，比如：添加、删除、修改、遍历等功能。\n当我们把这样的具体问题抽象成用列表去解决的时候，往往可以简化问题。\n\n```Javascript\nlet List = require('hzl-data-structures');\nlet list = new List();\n\n\n```\n\n### 数组 \u003cspan id=\"array\"\u003e\u003c/span\u003e\n数组是最简单、也是使用最广泛的数据结构。数组是可以在内存中连续存储多个元素的结构，在内存中的分配也是连续的，数组中的元素通过数组下标进行访问，数组下标从0开始。\n\n### 栈 \u003cspan id=\"stack\"\u003e\u003c/span\u003e\n栈也是一种非常常见的数据结构,在计算机的世界里,在计算机的世界里,\n栈是一种很高效的数据结构,因为数据只能在栈顶添加或者删除.\n因此栈也被称为一种后入先出的数据结构.栈的使用遍布程序语言实现的方方面面,\n从表达式求值到函数调用.\n\n### 队列 \u003cspan id=\"queue\"\u003e\u003c/span\u003e\n队列是一种前进先出的数据结构. 在日常生活中非常常见:比如去银行排队办理业务.\n在计算机中也极其常见, 很多情况下,当有大量任务需要完成时, 就会把任务暂时加入到\n任务队列中, 执行一个删除一个,继续执行下一个任务.\n\n### 链表 \u003cspan id=\"list\"\u003e\u003c/span\u003e\n有时候数组不一定是最佳的组织数据的数据结构，因为数组通常都是固定大小的，当数据填满时，\n再加入新元素就变得很困难。在数组中，添加和删除元素也很麻烦，因为要移动数组中的其他元素。\n因此如果需要频繁的添加或者删除元素，可以考虑使用链表组织数据。\n\n### 集合 \u003cspan id=\"set\"\u003e\u003c/span\u003e\n\n### 散列表 \u003cspan id=\"hash\"\u003e\u003c/span\u003e\n散列表，也叫哈希表，是根据关键码和值 (key和value) 直接进行访问的数据结构，通过key和value来映射到集合中的一个位置，这样就可以很快找到集合中的对应元素。\n\n### 树 \u003cspan id=\"tree\"\u003e\u003c/span\u003e\n树是一种数据结构，它是由n（n\u003e=1）个有限节点组成一个具有层次关系的集合。把它叫做 “树” 是因为它看起来像一棵倒挂的树，也就是说它是根朝上，而叶朝下的。在日常的应用中，我们讨论和用的更多的是树的其中一种结构，就是二叉树。\n\n### 堆 \u003cspan id=\"heap\"\u003e\u003c/span\u003e\n堆是一种比较特殊的数据结构，可以被看做一棵树的数组对象，具有以下的性质： 堆中某个节点的值总是不大于或不小于其父节点的值； 堆总是一棵完全二叉树。\n\n### 图 \u003cspan id=\"graph\"\u003e\u003c/span\u003e\n图是由结点的有穷集合V和边的集合E组成。其中，为了与树形结构加以区别，在图结构中常常将结点称为顶点，边是顶点的有序偶对，若两个顶点之间存在一条边，就表示这两个顶点具有相邻关系。\n\n## 参考\n* [《数据结构与算法JavaScript描述》]()\n* [《学习JavaScript数据结构与算法》]()\n* [《算法导论（原书第3版）》]()\n* [《大话数据结构》]()\n* [Javascript API手册](http://www.w3school.com.cn/jsref/jsref_obj_array.asp)\n* [ECMAScript](http://www.ecma-international.org/ecma-262/6.0/)\n* [Mozilla JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)\n\n\n## License\n\nMIT","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaizlin%2Fdata-structures","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhaizlin%2Fdata-structures","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaizlin%2Fdata-structures/lists"}