Implementation of data structures from MIT’s 6.851 Advanced Data Structures course (Spring 2012) in Guile Scheme.
- Course: 6.851 Advanced Data Structures
- Instructor: Prof. Erik Demaine
- Term: Spring 2012
- Implementation Language: Guile Scheme
- Approach: Literate programming with Org-mode
- Emacs (for org-mode support)
- Guile 2.2+ (or Guile 3.0)
- SQLite3
- Python 3 (for downloading tools)
- wget (for mirroring)
- yt-dlp (for video downloads)
This course requires strong background in algorithms and data structures. See the prerequisites guide for detailed preparation information:
- **Essential**: MIT 6.046 (Design and Analysis of Algorithms) or equivalent
- **Recommended**: MIT 6.854 (Advanced Algorithms) or equivalent
- **Mathematical**: Strong proof-writing skills, probability theory, amortized analysis
Quick self-assessment: Can you implement balanced BSTs, analyze amortized costs, and write mathematical proofs? If not, review the prerequisites first.
- Clone the repository:
git clone https://github.com/aygp-dr/mit-6851-advanced-data-structures.git cd mit-6851-advanced-data-structures
- Check dependencies:
make check-deps
- Setup environment:
make setup
- Download course materials:
make download-materials # PDFs and website mirror make download-videos # Video lectures (optional)
- Setup scribe templates:
make scribe-template
Each lecture session has its own directory with implementation, tests, and notes:
# Work on Session 1
make session-1
# List all sessions
make list-sessions
# Run tests for current session
cd sessions/01-persistent-data-structures
make test
# Run all tests
make test
# Run session-specific tests
cd sessions/01-persistent-data-structures
guile tests/test-persistent-stack.scm
- Copy the template:
cp templates/lec-template.org scribes/lec01.org
- Edit in Emacs with org-mode
- Export to LaTeX:
make export-scribe ORG_FILE=scribes/lec01.org
Session notes use org-mode with embedded Scheme code:
#+BEGIN_SRC scheme :tangle src/implementation.scm
(define (persistent-operation data)
;; Implementation here
...)
#+END_SRC
Extract code with:
make tangle # In session directory
. ├── lib/ # Core library implementations ├── tests/ # Main test suite ├── sessions/ # Session-specific implementations │ ├── 01-persistent-data-structures/ │ │ ├── Makefile # Session build rules │ │ ├── notes/ # Org-mode literate notes │ │ ├── src/ # Extracted source code │ │ └── tests/ # Session tests │ └── ... ├── materials/ # Downloaded materials (gitignored) │ ├── pdfs/ # Lecture PDFs │ ├── videos/ # Video lectures │ └── mirror/ # Website mirrors ├── scripts/ # Utility scripts ├── templates/ # Document templates └── Makefile # Main build system
- [X] Persistent Stack (Session 1)
- [X] Versioned Stack (Session 1)
- [ ] Persistent Queue
- [ ] Retroactive Queue
- [ ] Retroactive Priority Queue
- [ ] Point Location
- [ ] Orthogonal Range Trees
- [ ] Fractional Cascading
- [ ] Kinetic Data Structures
- [ ] Splay Trees
- [ ] Tango Trees
- [ ] Multi-Splay Trees
- [ ] B-Trees
- [ ] Cache-Oblivious B-Trees
- [ ] Buffer Trees
- [ ] Cache-Oblivious Priority Queues
- [ ] Van Emde Boas Trees
- [ ] X-fast Tries
- [ ] Y-fast Tries
- [ ] Fusion Trees
- [ ] Suffix Arrays
- [ ] Suffix Trees
- [ ] Suffix Automata
- [ ] Rank/Select
- [ ] Succinct Trees
- [ ] Compressed Text Indexes
- [ ] Link-Cut Trees
- [ ] Euler Tour Trees
- [ ] Dynamic Connectivity
Tests use SRFI-64 framework:
(use-modules (srfi srfi-64))
(test-begin "data-structure-name")
(test-group "operation-group"
(test-assert "description"
(condition)))
(test-end "data-structure-name")
- Fork the repository
- Create a feature branch
- Implement with tests
- Update documentation
- Submit pull request
See PROJECT_NOTES.md for detailed guidelines.
- Use descriptive names (
stack-push
notpush
) - Predicates end with
?
(empty?
,stack-node?
) - Include docstrings for public functions
- Add complexity analysis in comments
- Okasaki, C. (1998). Purely Functional Data Structures
- Driscoll et al. (1989). Making Data Structures Persistent
- Demaine, E. (2012). 6.851 Lecture Notes
Educational implementation based on MIT OpenCourseWare materials. See LICENSE for details.
- Prof. Erik Demaine for the excellent course
- MIT OpenCourseWare for making materials freely available
- The Guile Scheme community for the implementation platform