clrs-qa / README.md
Siddharth899's picture
Update README.md
245ed4a verified
metadata
dataset_info:
  features:
    - name: id
      dtype: string
    - name: chapter
      dtype: string
    - name: section
      dtype: string
    - name: title
      dtype: string
    - name: source_file
      dtype: string
    - name: question_markdown
      dtype: string
    - name: answer_markdown
      dtype: string
    - name: code_blocks
      list:
        - name: lang
          dtype: string
        - name: code
          dtype: string
    - name: has_images
      dtype: bool
    - name: image_refs
      list: string
  splits:
    - name: train
      num_bytes: 1282175
      num_examples: 1016
  download_size: 609478
  dataset_size: 1282175
configs:
  - config_name: default
    data_files:
      - split: train
        path: data/train-*

CLRS Solutions QA

Short description.
A compact Q&A dataset distilled from the community-maintained CLRS solutions project. Each row contains:

  • the exercise question (markdown),
  • the answer (markdown),
  • book chapter/section metadata,
  • optional code blocks (language-tagged),
  • optional image references (relative paths from the source repo).

This set is useful for building retrieval, RAG, tutoring, and evaluation pipelines for classic algorithms & data structures topics.

⚠️ Attribution: This dataset is derived from the open-source repository walkccc/CLRS (MIT license). Credit belongs to @walkccc and all contributors. This packaging only restructures their content into a machine-friendly format.


Contents & Stats

  • Split(s): train
  • Rows: ~1,016
  • Source: Parsed from markdown files in walkccc/CLRS (third-edition exercises/solutions)

Note: A small number of rows reference images present in the original repo (docs/img/...). This dataset includes the image references (paths) as metadata; actual image files are not bundled here.


Also available (human-readable copies):

# JSONL
ds_json = load_dataset(
    "json",
    data_files="hf://datasets/Siddharth899/clrs-qa/data/train.jsonl.gz",
    token=True,  # needed if the repo is private
)

# CSV
ds_csv = load_dataset(
    "csv",
    data_files="hf://datasets/Siddharth899/clrs-qa/data/train.csv.gz",
    token=True,
)

Data Fields

Field Type Description
id string Stable row id composed from chapter/section/title (e.g., 02-2.3-5).
chapter string Chapter number as a zero-padded string (e.g., "02").
section string Section identifier as in the source (e.g., "2.3" or "2-1").
title string Exercise/problem label (e.g., "2.3-5" or "2-1").
source_file string Original markdown relative path in the source repo.
question_markdown string Exercise prompt in markdown.
answer_markdown string Solution/answer in markdown (often includes LaTeX).
code_blocks list of objects {lang, code} Zero or more language-tagged code snippets extracted from the answer.
has_images bool Whether this item references images.
image_refs list[string] Relative paths to referenced images in the original repo.

Example code_blocks entry:

[
  {"lang": "cpp", "code": "INSERTION-SORT(A)\n  ..."},
  {"lang": "python", "code": "def merge(...):\n  ..."}
]

Data Construction

  • Source: walkccc/CLRS

  • License upstream: MIT

  • Method: A small script parses chapter/section markdown files, extracts headings, prompts, answers, fenced code blocks, and image references, and emits JSONL → uploaded to the Hub (Parquet auto-materialized).

  • Known quirks:

    • Some answers are brief/telegraphic (mirroring the original).
    • Image references point to paths in the upstream repo; not all images are bundled here.
    • Math is plain markdown with LaTeX snippets ($...$, $$...$$); rendering depends on your viewer.

License

  • This dataset (packaging): MIT
  • Upstream content: MIT (from walkccc/CLRS)

You must preserve the original MIT license notice and attribute @walkccc and contributors when using this dataset.

MIT License

Copyright (c) walkccc
... (see upstream repository for the full license text)

Additionally, include attribution similar to:

“Portions of the content are derived from walkccc/CLRS (MIT). © The respective contributors.”


Citation

If you use this dataset, please cite both the dataset and the upstream project:

Dataset (this repo):

@misc{clrs_qa_dataset_2025,
  title  = {CLRS Solutions QA (walkccc-derived)},
  author = {Siddharth899},
  year   = {2025},
  howpublished = {\url{https://huggingface.co/datasets/Siddharth899/clrs-qa}},
  note   = {Derived from walkccc/CLRS (MIT)}
}

Upstream CLRS solutions:

@misc{walkccc_clrs,
  title         = {Solutions to Introduction to Algorithms (Third Edition)},
  author        = {walkccc and contributors},
  howpublished  = {\url{https://github.com/walkccc/CLRS}},
  license       = {MIT}
}

Contact & Maintenance

  • Maintainer of this dataset packaging: @Siddharth899
  • Issues / requests: open an issue on the HF dataset repo.