A web-based tool that analyzes source code and estimates time complexity using pattern-based logic such as loop detection, recursion tracking, and structural analysis.
This project is designed to help developers and students understand the efficiency of their code by automatically estimating time complexity and providing useful optimization insights.
It works by analyzing patterns in the code such as loops, nested structures, recursion, and sorting operations.
- Detects loops and nested loops
- Estimates time complexity (O(1), O(n), O(n²), etc.)
- Detects recursion patterns
- Identifies sorting operations (O(n log n))
- Provides detailed analysis metrics:
- Loop count
- Nesting depth
- Recursion detection
- Gives optimization suggestions
- Backend: Python (Flask)
- Frontend: HTML, CSS
- Logic: Pattern-based code analysis using Python
- User inputs or pastes code into the web interface
- System analyzes:
- Loop structures
- Nesting depth
- Recursion patterns
- Sorting keywords
- Generates:
- Estimated time complexity
- Insights and suggestions
Follow these steps to run the project on your system:
- Clone the repository: git clone https://github.com/shreydarshan/Smart-Code-Complexity-Analyzer.git cd Smart-Code-Complexity-Analyzer
- Install dependencies: pip install flask
- Run the application: python app.py
- Open in browser: Go to: http://127.0.0.1:5000
Shrey Darshan
GitHub: https://github.com/shreydarshan
LinkedIn: https://www.linkedin.com/in/shrey-darshan-69431732a