algorithms CLAUDE.md

Repository instructions for a teaching collection of standalone data-structure and algorithm examples written in many programming languages.

In plain words
What is it for?
Use them when adding or updating algorithm examples, keeping expected program output current, and updating the relevant algorithm directory’s README.
Why use it?
They clarify that each example is a complete runnable program, not part of one library or application, and explain the project’s flat file layout and Chinese documentation.

Instructions file

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/microwind/algorithms/claude-md
Clone the repo
git clone --depth 1 https://github.com/microwind/algorithms
Per session 2,106 This file is loaded in full into every session.
When invoked 2,106 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.02106 $0.02106
Opus 5 $0.01053 $0.01053
Sonnet 5 $0.00421 $0.00421
Haiku 4.5 $0.00211 $0.00211

Measured 2d ago against content hash 1129c3e8abb4, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

algorithms CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

CLAUDE.md · 118 lines

How it starts

The opening of the file, as written. The whole thing — 118 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CLAUDE.md

本文件为 Claude Code (claude.ai/code) 在本仓库中工作时提供指引。

仓库定位

本仓库是一个教学参考型代码库,使用多种编程语言(C、C++、Java、Kotlin、Python、JavaScript、TypeScript、Go、Rust、Swift、Dart、C#、Objective-C)并行实现常见数据结构与算法。它不是一个库或应用程序——没有项目级的构建系统、包管理器或测试运行器。每个源文件都是独立可运行的演示程序,面向学习者。

主要受众使用中文阅读:README.md(中文)是核心说明,README_en.md 是其英文镜像。代码注释也使用中文。

架构

一种语言一个文件,每个算法平铺存放

每个算法/数据结构都有自己的目录。各语言实现作为同级文件直接放在该目录下(而非嵌套在 implementations/<lang>/ 之下)。例如,sorting/bubblesort/ 中包含 bubble_sort.cbubble_sort.pyBubbleSort.javabubble_sort.gobubble_sort.rs 等,连同一个 README.md 平铺在一起。

注意:STRUCTURE.md 描述的是一种"理想化"的嵌套结构(implementations/c/implementations/java/ 等),但仓库并未采用该结构。新增文件时请遵循现有的扁平约定,否则会破坏 README 中的链接表。

每个文件都是完整可运行的演示

每个实现文件都:

  • 包含署名为 [email protected] 的版权头
  • 定义算法本体并提供 main 函数(或 if __name__ == "__main__": 等入口)
  • 内嵌测试数据(排序类通常使用 [7, 11, 9, 10, 12, 13, 8])并打印结果
  • 通常在同一文件中包含同一算法的多个变体(例如 bubbleSort1/2/3/4,或 quicksort 的 7 种变体),用以对比优化策略与各语言惯用写法
  • 在文件末尾以多行注释形式给出预期 stdout 输出——这就是测试基准。修改算法行为时,必须同步更新该末尾注释。

仓库中没有独立于实现的单元测试文件。验证方式是运行文件,将其输出与文件末尾的预期输出注释进行对比。

每个目录的 README 即为规范

每个算法目录下的 README.md 是该算法的"权威说明":包含算法解释、mermaid 图、复杂度分析以及指向各语言文件的链接表。新增某种语言的实现时,务必更新该目录的 README.md,使链接/表格保持完整。仓库根目录的 README.mdREADME_en.md 同样直接链接到具体语言文件——尽量保持文件名稳定。

顶层目录组织(按教学路径,而非工程模块)

start-here/              入门指南与学习路线(仅 Markdown)
data-structures/         array、linked、stack、queue、tree、heap、graph、hash、map、set、list、struct
algorithmic-thinking/    greedy、divide-and-conquer、dynamic-programming、backtracking、
                         branch-and-bound、random-algorithm、search-algorithms
sorting/  searching/  string/  tree/  graph/        经典算法分类
array/  recursion/  bit-manipulation/  math/  date-time/   专题算法集合
compression/  cryptography/  network-flow/         专项算法
practice-projects/       实战项目(bloom-filter、cache-system、rate-limiter、
                         consistent-hashing 等)——这些项目**确实**采用了
                         src/<lang>/ + tests/ + docs/ + requirements.txt 的常规布局
problem-sets/            LeetCode 风格题库,按 easy/medium/hard/interview 分级
docs/  resources/        辅助文档、书籍、图片资源

Read the full file on GitHub · 118 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 118 lines · 2,106 tokens per session scan A 1129c3e8abb4

Subscribe to this mod's changes

algorithms CLAUDE.md is an instructions file published in the GitHub repository microwind/algorithms (174 stars, last pushed 2mo ago), licensed MIT. It adds 2,106 tokens to every session, about $0.0105 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other instructions, from other repositories