This repository provides a fun and interactive way to practice Data Structures and Algorithms (DSA) concepts using mythical creatures as the theme. Each mythical creature corresponds to a specific algorithm or data structure concept, with tasks designed to reinforce learning through Test-Driven Development (TDD).
- Ruby (version 3.0 or newer recommended)
- Bundler (to manage dependencies)
- Git (to clone the repository)
Open your terminal. Clone the repository:
Navigate to the project directory:
-
cd mythical_creatures_dsa
-
mkdir lib
-
Install Dependencies
-
Run Bundler to install required gems:
-
bundle install
-
Run the Tests
-
Use RSpec to run all tests and see your progress:
-
bundle exec rspec
-
To run tests for a specific category (algorithms or creatures), provide the folder path:
-
bundle exec rspec spec/algorithms
-
bundle exec rspec spec/creatures
-
To run tests for a specific creature or algorithm, provide the spec file path:
-
bundle exec rspec spec/creatures/gremlin_spec.rb
How to Use the Repository
- Choose a Category Algorithms: Learn the basics of individual DSA concepts, like Linear Search or Merge Sort. Creatures: Implement DSA concepts in the context of a mythical creature with specific behaviors.
- Solve the Problems Navigate to the relevant spec file (in spec/algorithms or spec/creatures) to see the tasks and requirements. Implement the corresponding class or method in the lib folder to make the tests pass.
- Run Tests Use RSpec to verify your solutions. Start with the simpler exercises (e.g., linear_search_spec.rb or gremlin_spec.rb) and progress to more challenging ones. List of Creatures and Algorithms
Creatures:
-
Gremlin: Linear Search (Easy)
-
Sphinx: Binary Search (Easy-Medium)
-
Hydra: Merge Sort (Medium)
-
Phoenix: Quick Sort (Medium-Hard)
-
Minotaur: Depth-First Search (Hard)
-
Unicorn: Breadth-First Search (Hard)
-
Balrog: Multiple Data Structures and Algorithms (Very Hard)
-
Orc(Bonus): OOP practice
Algorithms:
-
Linear Search
-
Binary Search
-
Merge Sort
-
Quick Sort
-
Depth-First Search
-
Breadth-First Search
-
Insertion Sort
Contributing
Contributions are welcome! If you’d like to add new creatures, algorithms, or features, follow these steps:
Fork the repository. Create a new branch for your feature: git checkout -b feature-name Make your changes and ensure all tests pass. Push your branch and open a pull request.