How Data Structures and Algorithms Courses Are Structured in cs-self-learning
The cs-self-learning repository organizes every Data Structures and Algorithms course as a self-contained markdown file under docs/数据结构与算法/, following a uniform template that includes course metadata, prerequisites, curated resources, and bilingual versions for seamless navigation in the MkDocs-generated site.
The PKUFlyingPig/cs-self-learning repository serves as a comprehensive index of computer science courses for self-directed learners. Its Data Structures and Algorithms (DSA) section implements a strict markdown architecture that standardizes how course information is presented, compared, and consumed across the static site.
Directory Structure and Bilingual Support
Every DSA course lives as an individual markdown file inside the docs/数据结构与算法/ directory. The repository maintains parallel language versions for accessibility: each course has a Chinese version (e.g., CS61B.md) and an English version (e.g., CS61B.en.md) with identical structural layouts.
The top-level navigation is defined in mkdocs.yml, which registers the entire DSA collection under the "数据结构与算法" heading. When the CI pipeline in .github/workflows/ci.yml runs mkdocs build, it automatically renders these files into a searchable, navigable website at csdiy.wiki.
Standardized Course Page Layout
Each markdown file follows a rigid template defined in template.md, ensuring predictable information architecture across all entries.
Course Header and Overview
The document begins with an H1 header containing the official course name, followed by a ## Descriptions section that captures critical metadata. According to the source files, this section includes:
- Institution offering the course
- Prerequisites (e.g., CS61B requires CS61A; CS170 requires CS61B and CS70)
- Primary programming language (e.g., Java for CS61B)
- Difficulty rating using star emojis (🌟🌟🌟)
- Total class hours (e.g., 60 hours)
In docs/数据结构与算法/CS61B.en.md, the Descriptions section explicitly lists Prerequisites: CS61A, Programming Languages: Java, and Class Hour: 60 hours to establish the learning path context.
Detailed Narrative
Following the metadata, a free-form paragraph describes the course's pedagogical approach, content depth, and engineering focus. The CS61B entry notes it is "the second course of UC Berkeley's CS61 series" and involves writing "thousands of lines of engineering code," giving learners insight into the workload intensity.
Curated Resources
The ## Resources or ## Course Resources section centralizes all official links, including the course website, video recordings, textbook references, and assignment archives. For example, CS61B links directly to https://sp24.datastructur.es/.
Additionally, a Personal Resources subsection links to the author's own GitHub repositories (such as PKUFlyingPig/CS61B) where solutions, notes, and implementations are maintained for reference.
Architectural Benefits for Self-Learning
This structure provides several technical advantages for maintaining and consuming educational content:
- Uniform Template: Contributors copy
template.mdto add new courses, guaranteeing consistent section headers and metadata fields. - Clear Prerequisite Chains: Explicit dependencies allow learners to build valid topological sorts of their study plans without external research.
- Resource Centralization: Official and community resources coexist in single files, reducing context switching between multiple browser tabs.
- Automated Site Generation: The MkDocs configuration ingests the markdown directly, meaning updates to
docs/数据结构与算法/files immediately reflect on the live site after CI completion.
Working with the DSA Course Files
Linking to a Course Internally
To reference a DSA course from another markdown file in the repository:
If you want a solid foundation in Java-based data structures, check out
[CS61B: Data Structures and Algorithms](
https://github.com/PKUFlyingPig/cs-self-learning/blob/master/docs/数据结构与算法/CS61B.md).
Adding a New Course
The workflow for contributing a new DSA entry involves copying the template and registering it in navigation:
# From the repository root
cp template.md docs/数据结构与算法/NewCourse.md
# Edit NewCourse.md to populate the required sections
Then update mkdocs.yml to include the new entry:
nav:
- 数据结构与算法:
- CS61B: docs/数据结构与算法/CS61B.md
- NewCourse: docs/数据结构与算法/NewCourse.md
The CI workflow in .github/workflows/ci.yml automatically rebuilds the site when these changes are pushed.
Programmatically Listing DSA Courses
To extract all DSA course paths programmatically from the navigation configuration:
import yaml, pathlib
mkdocs = yaml.safe_load(pathlib.Path('mkdocs.yml').read_text())
dsa = next(item for item in mkdocs['nav'] if isinstance(item, dict) and '数据结构与算法' in item)
for title, path in dsa['数据结构与算法'].items():
print(f"{title}: https://github.com/PKUFlyingPig/cs-self-learning/blob/master/{path}")
This script parses the YAML structure and generates direct GitHub URLs for each course file.
Summary
- Location: All Data Structures and Algorithms courses reside in
docs/数据结构与算法/as individual markdown files. - Template: Each file follows
template.md, ensuring consistent sections for descriptions, prerequisites, and resources. - Bilingual: Every course maintains parallel Chinese (
.md) and English (.en.md) versions. - Navigation: The
mkdocs.ymlconfiguration file controls site hierarchy, automatically rendering the DSA section via MkDocs. - Automation: The
.github/workflows/ci.ymlpipeline rebuilds the static site on every commit, keeping the course catalog synchronized with repository changes.
Frequently Asked Questions
How do I determine the prerequisites for a specific Data Structures and Algorithms course?
Each course page includes a ## Descriptions section that explicitly lists required prior courses. For example, docs/数据结构与算法/CS61B.en.md states Prerequisites: CS61A, while CS170.md requires both CS61B and CS70. This creates a clear dependency chain for planning your learning path.
Can I contribute a new DSA course to the repository?
Yes. Copy the template.md file to docs/数据结构与算法/YourCourse.md, fill in the standardized sections (header, descriptions, resources), and add the entry to mkdocs.yml under the 数据结构与算法 navigation key. The CI workflow will automatically build and deploy the updated site upon merge.
Why are there two versions of every course file?
The repository maintains bilingual support by providing both Chinese (.md) and English (.en.md) variants. This ensures accessibility for international audiences while preserving identical structural formatting and resource links across languages.
How does the site stay updated when new courses are added?
The repository uses GitHub Actions defined in .github/workflows/ci.yml. When changes are pushed to the master branch—including new files under docs/数据结构与算法/—the workflow executes mkdocs build to regenerate the static site, ensuring the live catalog reflects the latest repository state immediately.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →