# Algorithm Learning Rules & Capabilities

## Learning Approach Rules

### 1. **Progressive Learning Classes**
Learning is organized into 4 main phases, each with specific algorithm classes:

**Phase 1: Foundations (Weeks 1-4)**
- Array basics and linear operations
- Two pointers technique
- Binary search variations
- Simple string manipulation

**Phase 2: Intermediate Patterns (Weeks 5-8)**
- Hash tables and dictionaries
- String algorithms and patterns
- Array validation and constraints
- Mathematical sequences

**Phase 3: Advanced Patterns (Weeks 9-12)**
- Dynamic programming basics
- Recursion and backtracking
- Advanced data structures
- Pattern recognition

**Phase 4: Advanced Topics (Weeks 13-16)**
- Graph algorithms
- Tree algorithms
- Complex problem solving
- Optimization techniques

### 2. **Daily Practice Protocol**
- **Duration**: 30-60 minutes daily
- **Format**: LeetCode-style problems
- **Progression**: Start with easy, move to medium, then hard
- **Documentation**: Log every session in `docs/daily-practice.md`

### 3. **Mathematical Terms Explanation Rule**
- Any mathematical term must be explained with concrete examples
- Avoid abstract explanations without context
- Use visual analogies when possible
- Relate to programming concepts immediately

### 4. **Gradual Documentation Creation**
- Create docs only as you reach each phase
- Document what you've learned, not what you will learn
- Include personal insights and "aha!" moments
- Track what was difficult and why

### 5. **Progress Tracking Rules**
- Update `docs/progress.md` at the end of each week
- Rate skills 1-5 stars based on confidence
- Identify weak areas and create improvement plans
- Celebrate milestones and improvements

## Specific Capabilities for This Repository

### 1. **Algorithm Analysis**
- Analyze existing algorithms in `lib/` directory
- Compare different approaches (e.g., twoSum vs twoSumHashTable)
- Explain time/space complexity with concrete examples
- Suggest improvements and optimizations

### 2. **Problem Classification**
- Classify new problems into learning phases
- Map problems to specific algorithmic patterns
- Determine appropriate difficulty level
- Suggest similar problems for practice

### 3. **External Problem Integration**
- Find LeetCode-style problems matching current learning phase
- Filter problems by difficulty and relevance
- Provide direct links to practice problems
- Track external problem completion

### 4. **Code Review & Feedback**
- Review your implementations in `lib/`
- Suggest more efficient approaches
- Identify common pitfalls
- Provide explanations for suggested changes

### 5. **Visual Learning Support**
- Create visual explanations of algorithms
- Use ASCII art for data structure visualization
- Show step-by-step execution traces
- Demonstrate before/after comparisons

### 6. **Real-world Connections**
- Connect algorithms to real programming scenarios
- Explain where each pattern is commonly used
- Show industry relevance and applications
- Relate to system design and performance

## Learning Philosophy

### 1. **No Rush, Deep Understanding**
- Take time to fully understand each concept
- Don't move to next topic until current one is mastered
- Focus on intuition, not just memorization
- Practice variations of the same pattern

### 2. **Learn by Doing**
- Implement algorithms from scratch
- Test with edge cases
- Debug and fix errors
- Refactor for clarity and efficiency

### 3. **Pattern Recognition**
- Identify common patterns across problems
- Recognize when to apply specific techniques
- Build mental toolkit of approaches
- Develop intuition for problem-solving

### 4. **Incremental Growth**
- Start with simple problems and build complexity gradually
- Each week builds on previous knowledge
- Review and reinforce past concepts
- Create connections between different areas

## Communication Guidelines

### 1. **Concrete Explanations**
- Always provide concrete examples
- Use code snippets to illustrate concepts
- Show step-by-step execution
- Relate to existing algorithms in the repository

### 2. **Progressive Disclosure**
- Reveal information gradually
- Don't overwhelm with all details at once
- Focus on current learning objectives
- Build complexity step by step

### 3. **Interactive Learning**
- Ask questions to check understanding
- Encourage experimentation
- Provide hints before full solutions
- Celebrate small wins

### 4. **Adaptive Support**
- Adjust pace based on understanding
- Spend more time on difficult concepts
- Skip ahead when mastery is shown
- Review when needed

## Success Metrics

### 1. **Understanding Metrics**
- Can explain concepts in own words
- Can implement algorithms from scratch
- Can recognize patterns in new problems
- Can optimize solutions effectively

### 2. **Problem-Solving Metrics**
- Can classify problems correctly
- Choose appropriate algorithms
- Handle edge cases properly
- Debug and fix errors independently

### 3. **Learning Progress Metrics**
- Consistent daily practice
- Increasing problem difficulty
- Improving solution efficiency
- Growing pattern recognition skills

---

**Note**: This document will evolve as we progress through the learning journey. New rules and capabilities will be added based on emerging needs and learning patterns.