72 lines
2.4 KiB
Markdown
72 lines
2.4 KiB
Markdown
# Daily Practice Log
|
|
|
|
## 2026-05-17 - Week 1, Day 1
|
|
|
|
**Today's Focus**: Array basics and linear operations
|
|
**Learning Phase**: Phase 1, Week 1 - Foundations
|
|
**Difficulty Level**: Easy (Focus on understanding)
|
|
|
|
### Problems Solved Today
|
|
|
|
#### 1. Array Basics - Linear Search
|
|
**Problem**: Find target in unsorted array
|
|
**Approach**: Simple linear traversal
|
|
**Time Complexity**: O(n)
|
|
**Space Complexity**: O(1)
|
|
**Learning Points**:
|
|
- Linear search is straightforward for small arrays
|
|
- Important to check array bounds first
|
|
- Early termination when found improves average case
|
|
|
|
#### 2. Array Basics - Frequency Counting
|
|
**Problem**: Count occurrences of each element
|
|
**Approach**: Use hash map for frequency tracking
|
|
**Time Complexity**: O(n)
|
|
**Space Complexity**: O(n)
|
|
**Learning Points**:
|
|
- Hash maps are perfect for frequency counting
|
|
- Need to handle empty array case
|
|
- Can use array indices if elements are within range
|
|
|
|
#### 3. Array Basics - Find Minimum/Maximum
|
|
**Problem**: Find min and max in array
|
|
**Approach**: Single pass comparison
|
|
**Time Complexity**: O(n)
|
|
**Space Complexity**: O(1)
|
|
**Learning Points**:
|
|
- Can find both in one traversal
|
|
- Initialize with first element
|
|
- Update when finding smaller/larger values
|
|
|
|
### Key Learnings
|
|
1. **Array traversal patterns**: Start with simple loops, understand index management
|
|
2. **Basic operations**: Search, count, find min/max are fundamental building blocks
|
|
3. **Edge cases**: Always consider empty arrays, single element arrays
|
|
4. **Time complexity**: Linear time is acceptable for basic operations on small datasets
|
|
|
|
### Questions & Insights
|
|
- **Question**: When should I use linear search vs binary search?
|
|
**Answer**: Linear search for unsorted data, binary search for sorted data
|
|
- **Insight**: Basic array operations are simple but crucial for understanding more complex algorithms
|
|
- **Aha moment**: Frequency counting is the foundation for many hash map problems
|
|
|
|
### Tomorrow's Plan
|
|
**Focus**: Two pointers fundamentals
|
|
**Target Problems**:
|
|
1. Basic two sum (sorted array)
|
|
2. Container with most water
|
|
3. Array intersection (sorted)
|
|
|
|
### Repository Connection
|
|
**Related algorithms in lib/**:
|
|
- `twoSum` - Two pointers approach
|
|
- `maxArea` - Container with most water
|
|
- `intersection` - Array intersection
|
|
|
|
---
|
|
|
|
**Practice Time**: 45 minutes
|
|
**Problems Completed**: 3
|
|
**Difficulty**: Easy (3/3)
|
|
**Success Rate**: 100%
|
|
**Next Steps**: Practice more array basics, move to two pointers tomorrow |