Provide implementations of advanced data structures
日本語の概要は準備中です。原文の説明を表示しています。
Automated Big-O complexity analysis of code and algorithms. Performs static analysis of loop structures, recursive call trees, space complexity estimation, and amortized analysis with detailed derivation documents.
インストールする前に、エージェントに与えられる指示の中身を確認できます。
A specialized skill for automated analysis of algorithm time and space complexity, providing Big-O notation analysis, detailed derivations, and optimization recommendations.
Analyze code and algorithms to determine:
Static Analysis
Complexity Types
Output Formats
AST MCP Server - Advanced code structure analysis:
# Provides AST parsing and complexity analysis
npm install -g @angrysky56/ast-mcp-server
Code Analysis MCP - Natural language code exploration:
# Deep code understanding with data flow analysis
npm install -g code-analysis-mcp
# Analyze a Python function
complexity-analyzer analyze --file solution.py --function two_sum
# Analyze C++ code with detailed derivation
complexity-analyzer analyze --file solution.cpp --verbose
# Compare multiple implementations
complexity-analyzer compare --files impl1.py impl2.py impl3.py
Input Code:
def find_pairs(arr, target):
n = len(arr)
result = []
for i in range(n): # O(n)
for j in range(i+1, n): # O(n-i) iterations
if arr[i] + arr[j] == target:
result.append((i, j))
return result
Analysis Output:
Time Complexity: O(n^2)
- Outer loop: n iterations
- Inner loop: (n-1) + (n-2) + ... + 1 = n(n-1)/2 iterations
- Total: O(n^2)
Space Complexity: O(k) where k = number of pairs found
- result array grows with matches
- Worst case: O(n^2) if all pairs match
Optimization Suggestion:
- Use hash table for O(n) time complexity
- Trade space for time: O(n) space
{
"analysis": {
"function": "string",
"language": "string",
"timeComplexity": {
"notation": "O(n^2)",
"bestCase": "O(1)",
"averageCase": "O(n^2)",
"worstCase": "O(n^2)",
"derivation": [
"Step 1: Outer loop runs n times",
"Step 2: Inner loop runs (n-1), (n-2), ..., 1 times",
"Step 3: Total = sum from 1 to n-1 = n(n-1)/2",
"Step 4: Simplify to O(n^2)"
]
},
"spaceComplexity": {
"notation": "O(n)",
"auxiliary": "O(n)",
"total": "O(n)",
"breakdown": {
"input": "O(n) - input array",
"result": "O(k) - output pairs",
"variables": "O(1) - loop counters"
}
},
"recommendations": [
{
"type": "optimization",
"description": "Use hash table approach",
"newComplexity": "O(n) time, O(n) space",
"tradeoff": "Space for time"
}
]
},
"metadata": {
"analyzedAt": "ISO8601 timestamp",
"confidence": "high|medium|low"
}
}
| Pattern | Complexity | Example |
|---|---|---|
| Single loop | O(n) | for i in range(n) |
| Nested independent | O(n*m) | for i in n: for j in m |
| Nested dependent | O(n^2) | for i in n: for j in range(i) |
| Logarithmic | O(log n) | while n > 0: n //= 2 |
| Nested log | O(n log n) | for i in n: j=1; while j<n: j*=2 |
| Pattern | Recurrence | Complexity |
|---|---|---|
| Linear | T(n) = T(n-1) + O(1) | O(n) |
| Binary | T(n) = T(n/2) + O(1) | O(log n) |
| Divide & Conquer | T(n) = 2T(n/2) + O(n) | O(n log n) |
| Exponential | T(n) = 2T(n-1) + O(1) | O(2^n) |
For recurrence T(n) = aT(n/b) + f(n):
| Case | Condition | Complexity |
|---|---|---|
| 1 | f(n) = O(n^c) where c < log_b(a) | O(n^(log_b(a))) |
| 2 | f(n) = O(n^c) where c = log_b(a) | O(n^c log n) |
| 3 | f(n) = O(n^c) where c > log_b(a) | O(f(n)) |
This skill enhances:
complexity-optimization - Identify and fix complexity bottlenecksleetcode-problem-solving - Verify solution complexityalgorithm-implementation - Validate implementation efficiencycode-review - Complexity-focused code review| Complexity | Name | Example |
|---|---|---|
| O(1) | Constant | Array access, hash lookup |
| O(log n) | Logarithmic | Binary search |
| O(n) | Linear | Array traversal |
| O(n log n) | Linearithmic | Merge sort, heap sort |
| O(n^2) | Quadratic | Nested loops, bubble sort |
| O(n^3) | Cubic | Matrix multiplication (naive) |
| O(2^n) | Exponential | Subsets, recursive fibonacci |
| O(n!) | Factorial | Permutations |
| Error | Cause | Resolution |
|---|---|---|
PARSE_ERROR | Invalid syntax | Check code syntax |
UNSUPPORTED_CONSTRUCT | Complex control flow | Simplify or annotate |
RECURSIVE_DEPTH | Deep recursion | Provide base case hints |
AMBIGUOUS_BOUNDS | Dynamic loop bounds | Annotate with constraints |
まだレビューはありません。使ってみた感想をお寄せください。
概要と使いどころ
Provide implementations of advanced data structures
日本語の概要は準備中です。原文の説明を表示しています。
Fresh adversarial code review with binary PASS/FAIL verdicts, evidence citations, and anchoring bias prevention via fresh reviewer spawning.
日本語の概要は準備中です。原文の説明を表示しています。
WASM-based instant code transforms for simple tasks, achieving 352x speedup over LLM inference with zero cost.
日本語の概要は準備中です。原文の説明を表示しています。
Coordinate Crew (persistent) and Polecat (transient) agents using Gas Town's hook-based work distribution and GUPP principle.
日本語の概要は準備中です。原文の説明を表示しています。
Generate visual representations of algorithm execution
日本語の概要は準備中です。原文の説明を表示しています。
Hierarchical coordination and drift detection with frequent checkpoints, shared memory coherence validation, role specialization enforcement, and short task cycles.
日本語の概要は準備中です。原文の説明を表示しています。