Skip to content

Commit e065b45

Browse files
docs(divide-and-conquer): add structured README with concepts, complexity analysis, and problem coverage
1 parent 135730d commit e065b45

1 file changed

Lines changed: 109 additions & 0 deletions

File tree

15-divide-and-conquer/README.md

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# 📘 Divide and Conquer (Folder 15)
2+
3+
## 🧠 Overview
4+
Divide and Conquer is a problem-solving paradigm where a problem is:
5+
1. Divided into smaller subproblems
6+
2. Solved recursively
7+
3. Combined to get the final result
8+
9+
This approach is efficient for sorting, searching, and optimization problems.
10+
11+
---
12+
13+
## 📌 Topics Covered
14+
15+
### 🔹 Sorting Algorithms
16+
- Merge Sort (Basic Implementation)
17+
- Merge Sort (Space Optimized)
18+
- Quick Sort
19+
20+
### 🔹 Searching Technique
21+
- Search in Sorted and Rotated Array
22+
23+
### 🔹 Analysis
24+
- Worst Case Analysis of Quick Sort
25+
26+
### 🔹 Practice Problems
27+
- Additional problems
28+
29+
---
30+
31+
## ⚡ Time & Space Complexity
32+
33+
| Algorithm | Best Case | Average Case | Worst Case | Space Complexity |
34+
|------------|------------|-------------|-------------|------------------|
35+
| Merge Sort | O(n log n) | O(n log n) | O(n log n) | O(n) |
36+
| Quick Sort | O(n log n) | O(n log n) | O(n^2) | O(log n) |
37+
38+
---
39+
40+
## 🔍 Key Concepts
41+
42+
### ✅ Merge Sort
43+
- Stable sorting algorithm
44+
- Uses extra space for merging
45+
- Guaranteed O(n log n) performance
46+
47+
### ✅ Quick Sort
48+
- In-place sorting algorithm
49+
- Faster in practice
50+
- Performance depends on pivot selection
51+
52+
### ⚠️ Worst Case in Quick Sort
53+
Occurs when:
54+
- Array is already sorted
55+
- Pivot is always smallest or largest
56+
57+
Result:
58+
- Time Complexity becomes O(n^2)
59+
60+
Optimization:
61+
- Random pivot
62+
- Median-of-three
63+
64+
---
65+
66+
## 🔁 Search in Rotated Sorted Array
67+
- Uses modified binary search
68+
- One half of the array is always sorted
69+
- Time Complexity: O(log n)
70+
71+
---
72+
73+
## 🧪 Practice Focus
74+
- Strengthen recursion + divide and conquer thinking
75+
- Improve problem-solving skills
76+
- Understand optimization techniques
77+
78+
---
79+
80+
## 🚨 Important Notes
81+
- Merge Sort is stable, Quick Sort is not
82+
- Merge Sort uses extra memory, Quick Sort is in-place
83+
- Algorithm choice depends on constraints
84+
85+
---
86+
87+
## 📂 File Structure
88+
89+
```
90+
15_divide_and_conquer/
91+
├── MergeSortBasic.java
92+
├── MergeSortOptimized.java
93+
├── QuickSort.java
94+
├── SearchInRotatedSortedArray.java
95+
├── PracticeProblems.java
96+
└── README.md
97+
```
98+
99+
---
100+
101+
## 🎯 Goal
102+
- Build strong understanding of Divide and Conquer
103+
- Write clean and optimized code
104+
- Prepare for interview-level problems
105+
106+
---
107+
108+
## 📌 Final Takeaway
109+
Divide and Conquer is about breaking complex problems into smaller parts and solving them efficiently.

0 commit comments

Comments
 (0)