Skip to content

Commit 0210792

Browse files
committed
Polish DSA guide formatting for GitHub
Replace remaining LaTeX-style complexity notation with plain text so the DSA course renders cleanly in GitHub markdown.
1 parent de21df4 commit 0210792

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

resources/dsa_course_python.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ For each topic:
4343

4444
### A Simple Problem-Solving Checklist
4545

46-
- **Step 1**: What is the input size? What’s the time limit? (choose \(O(n)\) vs \(O(n \log n)\))
46+
- **Step 1**: What is the input size? What’s the time limit? (choose `O(n)` vs `O(n log n)`)
4747
- **Step 2**: Can you restate the task as a pattern? (two pointers, sliding window, BFS…)
4848
- **Step 3**: What data structure makes the “key operation” fast?
4949
- **Step 4**: Write a first correct solution, then optimize
@@ -88,13 +88,13 @@ In interviews, most problems are testing:
8888

8989
### Time Complexity (Big-O) — the 80/20
9090

91-
- \(O(1)\): constant (hash lookup average)
92-
- \(O(\log n)\): binary search
93-
- \(O(n)\): one pass
94-
- \(O(n \log n)\): sorting, many divide-and-conquer
95-
- \(O(n^2)\): nested loops (often too slow when \(n\) is big)
91+
- `O(1)`: constant (hash lookup average)
92+
- `O(log n)`: binary search
93+
- `O(n)`: one pass
94+
- `O(n log n)`: sorting, many divide-and-conquer
95+
- `O(n^2)`: nested loops (often too slow when `n` is big)
9696

97-
### Example: “Is this \(O(n)\) or \(O(n^2)\)?”
97+
### Example: “Is this `O(n)` or `O(n^2)`?”
9898

9999
```python
100100
def has_duplicate(nums):
@@ -106,8 +106,8 @@ def has_duplicate(nums):
106106
return False
107107
```
108108

109-
- **Time**: \(O(n)\) average
110-
- **Space**: \(O(n)\)
109+
- **Time**: `O(n)` average
110+
- **Space**: `O(n)`
111111

112112
### Python essentials for coding interviews
113113

@@ -124,10 +124,10 @@ Arrays/lists are the most common interview input form.
124124

125125
### Core operations (list)
126126

127-
- **Index access**: \(O(1)\)
128-
- **Append**: \(O(1)\) amortized
129-
- **Insert/Delete in middle**: \(O(n)\)
130-
- **Membership test (`x in list`)**: \(O(n)\)
127+
- **Index access**: `O(1)`
128+
- **Append**: `O(1)` amortized
129+
- **Insert/Delete in middle**: `O(n)`
130+
- **Membership test (`x in list`)**: `O(n)`
131131

132132
### Prefix sums (pattern)
133133

@@ -865,7 +865,7 @@ def remove_duplicates(nums):
865865
### 11.3 Prefix sum (range queries and subarray counting)
866866

867867
- Range sum: use a prefix array
868-
- Counting subarrays with sum \(k\): prefix sum + hash map (Section 10)
868+
- Counting subarrays with sum `k`: prefix sum + hash map (Section 10)
869869

870870
### 11.4 Fast & slow pointers (cycle / middle)
871871

@@ -1091,9 +1091,9 @@ def bfs(start, graph):
10911091
### Adjacency matrix vs adjacency list
10921092

10931093
- **Adjacency matrix**: `matrix[u][v] = 1/weight`
1094-
- Fast edge check \(O(1)\), high memory \(O(V^2)\)
1094+
- Fast edge check `O(1)`, high memory `O(V^2)`
10951095
- **Adjacency list**: `graph[u] = [v1, v2, ...]` or `[(v,w), ...]`
1096-
- Memory \(O(V+E)\), best for sparse graphs (most interview problems)
1096+
- Memory `O(V+E)`, best for sparse graphs (most interview problems)
10971097

10981098
### Shortest path in an unweighted grid (state space graph)
10991099

@@ -1173,7 +1173,7 @@ def dijkstra(start, graph):
11731173

11741174
- **0-1 BFS**: when edge weights are only 0 or 1 (faster than Dijkstra)
11751175
- **Bellman-Ford**: when negative edge weights exist (can detect negative cycles)
1176-
- **Floyd-Warshall**: all-pairs shortest paths for small graphs (\(O(V^3)\))
1176+
- **Floyd-Warshall**: all-pairs shortest paths for small graphs (`O(V^3)`)
11771177

11781178
### DSU (Union-Find): connectivity / components
11791179

@@ -1239,10 +1239,10 @@ heapq.heappush(heap, 8)
12391239
smallest = heapq.heappop(heap) # 2
12401240
```
12411241

1242-
- `heappush`: \(O(\log n)\)
1243-
- `heappop`: \(O(\log n)\)
1244-
- `heap[0]` (peek min): \(O(1)\)
1245-
- `heapify(list)`: \(O(n)\)
1242+
- `heappush`: `O(log n)`
1243+
- `heappop`: `O(log n)`
1244+
- `heap[0]` (peek min): `O(1)`
1245+
- `heapify(list)`: `O(n)`
12461246

12471247
### Min-heap vs max-heap
12481248

@@ -1258,7 +1258,7 @@ heapq.heapify(max_heap)
12581258
largest = -heapq.heappop(max_heap) # 4
12591259
```
12601260

1261-
### Pattern 1: Top K largest elements (\(O(n \log k)\))
1261+
### Pattern 1: Top K largest elements (`O(n log k)`)
12621262

12631263
This is one of the most common heap interview patterns.
12641264

@@ -1561,7 +1561,7 @@ def knapsack_01(weights, values, capacity):
15611561

15621562
Two common solutions:
15631563

1564-
#### \(O(n^2)\) DP (easy to explain)
1564+
#### `O(n^2)` DP (easy to explain)
15651565

15661566
```python
15671567
def lis_n2(nums):
@@ -1575,7 +1575,7 @@ def lis_n2(nums):
15751575
return max(dp)
15761576
```
15771577

1578-
#### \(O(n \log n)\) (binary search / patience sorting idea)
1578+
#### `O(n log n)` (binary search / patience sorting idea)
15791579

15801580
Maintain `tails[k]` = smallest possible tail of an increasing subsequence of length `k+1`.
15811581

0 commit comments

Comments
 (0)