Algorithm Complexity Analyzer
A real-time algorithm complexity analyzer that uses AI to determine Big O notation and generates performance graphs through dynamic execution testing.
🚀 Features
- AI-Powered Analysis: Uses Google's Gemini 2.5 Flash to analyze algorithm complexity
- Multi-Language Support: Analyze algorithms written in JavaScript, Python, Go, and more
- Real-Time Performance Testing: Dynamically executes code with varying input sizes
- Adaptive Benchmarking: Automatically adjusts iterations to maintain optimal test duration
- Interactive Visualization: Real-time performance graphs using Chart.js
- Static Code Analysis: Detailed breakdown of algorithm structure and patterns
🔧 Installation
- Clone the repository:
git clone https://github.com/luciferreeves/complexity-analyzer.git
cd complexity-analyzer
- Install dependencies:
go mod download
- Set up environment variables:
cp .env.example .env
Edit .env and add your Gemini API key:
GEMINI_API_KEY=your-api-key-here
PORT=3000
- Run the application:
go run main.go
- Open your browser:
http://localhost:3000
🧠 How It Works
-
AI Analysis: Gemini AI analyzes your code and determines:
-
Time complexity notation
- Algorithm approach and patterns
-
Appropriate test sizes
-
Dynamic Testing: The system:
-
Generates complete Go test program
- Runs algorithm with increasing input sizes
- Adaptively adjusts iterations
-
Measures execution time with high precision
-
Visualization: Results are displayed with:
- Complexity badge with confidence score
- Static analysis insights
- Interactive performance graph
- Detailed timing breakdown
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
📝 License
This project is licensed under the MIT License - see the LICENSE file for details.
Built with ❤️ using Go
