{"id":48921627,"url":"https://github.com/xuerzong/data-structure","last_synced_at":"2026-04-17T05:09:30.016Z","repository":{"id":38082294,"uuid":"488509617","full_name":"xuerzong/data-structure","owner":"xuerzong","description":"Data structures implemented by typescript.","archived":false,"fork":false,"pushed_at":"2023-11-13T08:04:45.000Z","size":124,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-19T00:46:18.144Z","etag":null,"topics":["data-structure","data-structures","linked-list","queue","stack","tree","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@xuerzong/data-structure","language":"TypeScript","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/xuerzong.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2022-05-04T08:30:18.000Z","updated_at":"2023-05-07T15:34:31.000Z","dependencies_parsed_at":"2023-11-13T09:25:55.116Z","dependency_job_id":"c7cb7cc1-1ca8-46db-b9d8-3d27bec33878","html_url":"https://github.com/xuerzong/data-structure","commit_stats":{"total_commits":35,"total_committers":1,"mean_commits":35.0,"dds":0.0,"last_synced_commit":"15c8b960949e3f9cc91309a5284b5fd85f8cdba3"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/xuerzong/data-structure","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuerzong%2Fdata-structure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuerzong%2Fdata-structure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuerzong%2Fdata-structure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuerzong%2Fdata-structure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xuerzong","download_url":"https://codeload.github.com/xuerzong/data-structure/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuerzong%2Fdata-structure/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31915936,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T18:22:33.417Z","status":"online","status_checked_at":"2026-04-17T02:00:06.879Z","response_time":62,"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-structure","data-structures","linked-list","queue","stack","tree","typescript"],"created_at":"2026-04-17T05:09:29.278Z","updated_at":"2026-04-17T05:09:30.001Z","avatar_url":"https://github.com/xuerzong.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# data-structure\n\nData structures implemented by typescript.\n\n## How to use\n\n```bash\nyarn add @xuerzong/data-structure\n```\n\n### BinaryTree\n\n```typescript\nimport { BinaryTree, BinaryTreeNode } from '@xuerzong/data-structure'\n\ntype TreeNode = BinaryTreeNode\u003cnumber\u003e\n\n/**\n * @reference https://leetcode.cn/problems/invert-binary-tree/ \n */\nfunction invertTree(root: TreeNode | null): TreeNode | null {\n  if(root === null) {\n    return root\n  }\n\n  [root.left, root.right] = [root.right, root.left]\n\n  invertTree(root.left)\n  invertTree(root.right)\n\n  return root\n}\n\nconst tree = BinaryTree.generate(...[2, 1, 3])\ninvertTree(tree.root)\nconsole.log(tree.bfs()) // [2, 3, 1]\n```\n\n## To do list\n\n- [x] Queue\n- [x] Stack\n- [x] LinkedList\n- [x] BinaryTree\n\n## License\n\n[MIT](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxuerzong%2Fdata-structure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxuerzong%2Fdata-structure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxuerzong%2Fdata-structure/lists"}