blob: 27d51ad9b0f9df61b851455c11755188e55b008e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
# 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
1. **Clone the repository:**
```bash
git clone https://github.com/luciferreeves/complexity-analyzer.git
cd complexity-analyzer
```
2. **Install dependencies:**
```bash
go mod download
```
3. **Set up environment variables:**
```bash
cp .env.example .env
```
Edit `.env` and add your Gemini API key:
```env
GEMINI_API_KEY=your-api-key-here
PORT=3000
```
4. **Run the application:**
```bash
go run main.go
```
5. **Open your browser:**
```
http://localhost:3000
```
## 🧠 How It Works
1. **AI Analysis**: Gemini AI analyzes your code and determines:
- Time complexity notation
- Algorithm approach and patterns
- Appropriate test sizes
2. **Dynamic Testing**: The system:
- Generates complete Go test program
- Runs algorithm with increasing input sizes
- Adaptively adjusts iterations
- Measures execution time with high precision
3. **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.
1. Fork the repository
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request
## 📝 License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
---
**Built with ❤️ using Go**
|