Skip to content

Devanik21/DSA-mastery-with-gemma-3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DSA Mastery With Gemma 3

Language Stars Forks Author Status

Master data structures and algorithms with an AI tutor — step-by-step explanations, code generation, complexity analysis, and adaptive practice problems.


Topics: algorithms · coding-assistant · competitive-programming · data-structures · deep-learning · education-ai · gemma-3 · generative-ai · google-ai · llm-tutoring

Overview

DSA Mastery with Gemma 3 is an AI-powered learning platform for data structures and algorithms, using Google's Gemma 3 language model as the teaching engine. It goes beyond static content: the tutor adapts to the learner's level, generates novel practice problems on demand, provides step-by-step execution traces with visual annotation, and offers multi-language code implementations with line-by-line commentary.

The platform covers the full DSA curriculum: arrays, linked lists, stacks, queues, trees (BST, AVL, heap, trie), graphs (BFS, DFS, Dijkstra, Bellman-Ford, Prim, Kruskal), dynamic programming (memoisation, tabulation, common problem families), sorting and searching algorithms, and string algorithms (KMP, Z-algorithm, suffix arrays). For each topic, the platform provides conceptual explanation, code implementation, time/space complexity analysis with formal proof sketch, and curated practice problems at Easy/Medium/Hard difficulty.

The complexity analysis module is particularly thorough: it not only states the Big-O complexity but explains the reasoning — recurrence relations for recursive algorithms, amortised analysis for dynamic arrays, and master theorem application for divide-and-conquer — building genuine analytical intuition rather than memorised complexity tables.


Motivation

DSA is the foundation of technical interviews at top technology companies and the backbone of efficient software engineering. Yet most learning resources present algorithms as static content: read the solution, understand it, move on. What learners need is an interactive partner who can explain, answer follow-up questions, generate variations, and challenge them with novel problems — which is exactly what an LLM tutor provides.


Architecture

Learner Query (topic / problem / code)
        │
  Topic Detection + Context Building
        │
  Gemma 3 Tutor (contextualised prompt)
  ├── Conceptual explanation
  ├── Step-by-step trace
  ├── Code generation (Python / C++ / Java)
  └── Complexity analysis
        │
  Practice Problem Generator
  (novel, parameterised, difficulty-scaled)
        │
  Progress tracker → Weak area identification

Features

Full DSA Curriculum Coverage

All major topics: arrays, linked lists, trees, graphs, heaps, tries, sorting/searching, DP, string algorithms — each with conceptual explanation, code, and complexity analysis.

Step-by-Step Algorithm Trace

Visual step-by-step execution trace with variable state at each step, array/tree state visualised in ASCII or Mermaid diagrams, and pointer movement annotation.

Multi-Language Code Generation

Implementations in Python (clean and readable), C++ (performance-focused with STL), and Java (OOP style) — with line-by-line comments explaining each step.

Formal Complexity Analysis

Time and space complexity derived from first principles: recurrence relations (T(n) = 2T(n/2) + O(n)), master theorem application, and amortised analysis for relevant algorithms.

Adaptive Problem Generator

Generate novel problems at Easy/Medium/Hard difficulty for any topic, with constraints, example test cases, and expected output — parameterised to avoid repetition.

Code Submission Evaluator

Paste your solution and receive feedback on correctness, edge case handling, time/space complexity, code style, and potential optimisations.

Conceptual Q&A

Ask any DSA question in natural language — 'Why is quicksort not stable?', 'When should I use a deque instead of a stack?' — and get a precise, educational answer.

Progress Dashboard

Track topics covered, problems solved, accuracy by difficulty level, and a heatmap of topic proficiency to guide study prioritisation.


Tech Stack

Library / Tool Role Why This Choice
Google Gemma 3 API AI tutoring engine Explanation generation, code synthesis, problem creation
Streamlit Application UI Chat interface, code rendering, progress dashboard
Python Primary language Algorithm implementations for verification
Plotly Visualisation Progress charts, topic proficiency radar
pandas Progress tracking Session history and topic performance storage

Key packages detected in this repo: streamlit · google-generativeai · plotly · pandas · numpy


Getting Started

Prerequisites

  • Python 3.9+ (or Node.js 18+ for TypeScript/JS projects)
  • pip or npm package manager
  • Relevant API keys (see Configuration section)

Installation

git clone https://github.com/Devanik21/DSA-mastery-with-gemma-3.git
cd DSA-mastery-with-gemma-3
python -m venv venv && source venv/bin/activate
pip install streamlit google-generativeai pandas plotly
echo 'GOOGLE_API_KEY=your_key_here' > .env
streamlit run app.py

Usage

streamlit run app.py

# CLI usage
python tutor_cli.py --topic 'binary search tree' --level medium

# Generate practice problems
python generate_problems.py --topic 'dynamic programming' --difficulty hard --count 5

Configuration

Variable Default Description
GOOGLE_API_KEY (required) Google API key for Gemma 3
DEFAULT_LANGUAGE python Code generation language: python, cpp, java
DIFFICULTY_DEFAULT medium Default problem difficulty: easy, medium, hard
TRACE_DETAIL high Step-by-step trace verbosity: low, medium, high

Copy .env.example to .env and populate all required values before running.


Project Structure

DSA-mastery-with-gemma-3/
├── README.md
├── requirements.txt
├── app.py
└── ...

Roadmap

  • Interactive code editor with test case runner for in-app solution verification
  • LeetCode problem import: paste a LeetCode URL and get AI hints without spoilers
  • Contest mode: timed problem sets simulating real technical interview sessions
  • Spaced repetition system for optimal review scheduling of mastered topics
  • Peer comparison: anonymised performance benchmarking against other learners

Contributing

Contributions, issues, and feature requests are welcome. Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/your-feature)
  3. Commit your changes (git commit -m 'feat: add your feature')
  4. Push to your branch (git push origin feature/your-feature)
  5. Open a Pull Request

Please follow conventional commit messages and ensure any new code is documented.


Notes

Gemma 3 API responses are educational explanations and should be verified against authoritative DSA references for critical applications. Complexity analyses are correct for standard algorithm implementations but may vary with specific optimisations.


Author

Devanik Debnath
B.Tech, Electronics & Communication Engineering
National Institute of Technology Agartala

GitHub LinkedIn


License

This project is open source and available under the MIT License.


Crafted with curiosity, precision, and a belief that good software is worth building well.

About

AI-powered DSA tutor using Gemma 3 — step-by-step algorithm traces, Big-O derivations via recurrence relations, multi-language code generation, and adaptive practice problems.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages