{"id":25665490,"url":"https://github.com/sleepingraven/algorithmnote","last_synced_at":"2025-07-25T09:03:39.391Z","repository":{"id":277686060,"uuid":"347319544","full_name":"sleepingraven/AlgorithmNote","owner":"sleepingraven","description":"Practical utilities in algorithm learning / OJ accepting.","archived":false,"fork":false,"pushed_at":"2022-02-26T15:12:56.000Z","size":221,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-24T07:19:16.129Z","etag":null,"topics":["algorithm","data-structure","demo","leetcode"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sleepingraven.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-03-13T08:51:07.000Z","updated_at":"2025-01-25T06:12:42.000Z","dependencies_parsed_at":"2025-02-15T12:41:33.937Z","dependency_job_id":null,"html_url":"https://github.com/sleepingraven/AlgorithmNote","commit_stats":null,"previous_names":["sleepingraven/algorithmnote"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sleepingraven/AlgorithmNote","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sleepingraven%2FAlgorithmNote","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sleepingraven%2FAlgorithmNote/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sleepingraven%2FAlgorithmNote/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sleepingraven%2FAlgorithmNote/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sleepingraven","download_url":"https://codeload.github.com/sleepingraven/AlgorithmNote/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sleepingraven%2FAlgorithmNote/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266983423,"owners_count":24016553,"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-07-25T02:00:09.625Z","response_time":70,"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":["algorithm","data-structure","demo","leetcode"],"created_at":"2025-02-24T07:19:17.879Z","updated_at":"2025-07-25T09:03:39.296Z","avatar_url":"https://github.com/sleepingraven.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Note Structure\n\n- \u003ccode\u003edraft\u003c/code\u003e OJ 代码编辑区域\n- \u003ccode\u003enote\u003c/code\u003e 笔记/练习\n    - \u003ccode\u003edemo\u003c/code\u003e，\u003ccode\u003ehelloworld\u003c/code\u003e 一些题目和基本数据结构的练习\n    - \u003ccode\u003ehuffman\u003c/code\u003e 用 Huffman 编码实现文件压缩\n    - \u003ccode\u003epractice\u003c/code\u003e 常见/常用算法实现\n- \u003ccode\u003eutil\u003c/code\u003e 工具/模板\n    - \u003ccode\u003eac\u003c/code\u003e，\u003ccode\u003eadvanced\u003c/code\u003e 常用数据结构/工具类\n    - \u003ccode\u003ecommon\u003c/code\u003e，\u003ccode\u003efunction\u003c/code\u003e，\u003ccode\u003eprimitive\u003c/code\u003e 基础工具类\n    - \u003ccode\u003edatastructure\u003c/code\u003e 二叉树、链表的生成和格式化工具\n\n\u003cbr /\u003e\n\n## 1. \u003ccode\u003enote\u003c/code\u003e\n\n### \u003ccode\u003ehuffman\u003c/code\u003e\n\n压缩/解压文件的程序实现\n\ndemo:\n\n```java\nString srcPath = \"D:/new Text Document.pdf\";\nStoreWay storeWay = new CodeCustom();\nCodingMethod codingMethod = new DefaultCodingMethod();\n\nCompressor compressor = new Compressor(1);\nString destPath = compressor.compress(srcPath, storeWay, codingMethod);\nDecompressor decompressor = new Decompressor();\nString decompressPath = decompressor.decompress(destPath, codingMethod);\n\nSystem.out.println(destPath);\nSystem.out.println(decompressPath);\n```\n\noutput:\n\n```\n……\n用时：        834ms\n\n\nD:\\new Text Document.h_tar\nD:\\new Text Document(1).pdf\n```\n\n### \u003ccode\u003epractice\u003c/code\u003e\n\n#### \u003ccode\u003eCircularVector\u003c/code\u003e\n\n用来在矩阵中以螺旋的顺序生成一组下标\n\ndemo:\n\n```java\nfinal int n = 4;\nint[][] matrix = new int[n][n];\nCircularVector cv = new CircularVector(0, n - 1, 0, n - 1);\nfor (int i = 1; i \u003c= n * n; i++) {\n    matrix[cv.x()][cv.y()] = i;\n    cv.next();\n}\n\nString str = Arrays.stream(matrix).map(Arrays::toString).collect(Collectors.joining(\"\\n\"));\nSystem.out.println(str);\n```\n\noutput:\n\n```\n[1, 2, 3, 4]\n[12, 13, 14, 5]\n[11, 16, 15, 6]\n[10, 9, 8, 7]\n```\n\n## 2. \u003ccode\u003eutil\u003c/code\u003e\n\n### \u003ccode\u003eac\u003c/code\u003e\n\n#### \u003ccode\u003eDataGenerator\u003c/code\u003e\n\n用来\n\n- 根据数组创建二叉树、链表\n- 将字符串解析成数组\n\ndemo:\n\n```java\nint[][] matrix = DataGenerator.parseIntArray(\"[[1,2,3],[4,5,6],[7,8,9]]\", int[][].class);\n\nString str = Arrays.stream(matrix).map(Arrays::toString).collect(Collectors.joining(\"\\n\"));\nSystem.out.println(str);\n```\n\noutput:\n\n```\n[1, 2, 3]\n[4, 5, 6]\n[7, 8, 9]\n```\n\n### \u003ccode\u003edatastructure\u003c/code\u003e\n\n用来\n\n- 生成二叉树、链表\n- 格式化二叉树、链表\n\ndemo:\n\n```java\nfinal int n = 31;\nInteger[] a = IntStream.range(1, n + 1).boxed().toArray(i -\u003e new Integer[n]);\nTreeNode treeNode = DataGenerator.buildTree(a);\n\nString str = treeNode.toString();\nSystem.out.println(str);\n```\n\noutput:\n\n```\n                              1\n                      /               \\\n              2                               3\n          /       \\                       /       \\\n      4               5               6               7\n    /   \\           /   \\           /   \\           /   \\\n  8       9      10      11      12      13      14      15\n / \\     / \\     / \\     / \\     / \\     / \\     / \\     / \\\n16  17  18  19  20  21  22  23  24  25  26  27  28  29  30  31\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsleepingraven%2Falgorithmnote","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsleepingraven%2Falgorithmnote","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsleepingraven%2Falgorithmnote/lists"}