Skip to content

Commit a4eabfc

Browse files
committed
Update README.md
1 parent 0646ad2 commit a4eabfc

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

README.md

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Data Structures and Algorithms
22

3-
These notes can be used to find top patterns for each category. Moreover, it can take an evening to refresh your knowledge or understand the important part of each pattern. I highly recommend the following materials (ordered by importance). This repository provides the notes taken from all these sources.
3+
These notes can be used to find top patterns for each category. Note that reading these notes can be much faster than watching videos. Moreover, it can take only take an evening to refresh your knowledge or understand the important part of each pattern. I highly recommend the following materials (ordered by importance). This repository provides the notes taken from all these sources.
44

5-
- [Udacity nano degree: Data Structures and Algorithms](https://www.udacity.com/course/data-structures-and-algorithms-nanodegree--nd256)
6-
- [Data Structures, Algorithms, and Machine Learning Optimization](https://www.oreilly.com/library/view/data-structures-algorithms/9780137644889/)
7-
- [Data Structures and Algorithmic Thinking With Python](https://www.amazon.com/Data-Structure-Algorithmic-Thinking-Python/dp/8192107590)
5+
- [Udacity nano degree: Data Structures and Algorithms](https://www.udacity.com/course/data-structures-and-algorithms-nanodegree--nd256)
6+
- [Data Structures and Algorithmic Thinking With Python](https://www.amazon.com/Data-Structure-Algorithmic-Thinking-Python/dp/8192107590)
7+
- [Data Structures, Algorithms, and Machine Learning Optimization](https://www.oreilly.com/library/view/data-structures-algorithms/9780137644889/) [If you are intrested in ML]
88
- [Bari's YouTube playlist](https://www.youtube.com/watch?v=0IAPZzGSbME&list=PLDN4rrl48XKpZkf03iYFl-O29szjTrs_O) [If you are a beginner]
99

1010

@@ -226,6 +226,27 @@ Everythin less than 8 are already below 8 so cemented
226226

227227
O(n2) if it’s already sorted. Why? Wasting time
228228

229+
230+
## Sliding Window
231+
How to tell if its a sliding window problem?
232+
• Deals with arrays
233+
• Find/calculate among subarrays
234+
235+
> Q: Given an array, find the average of each subarray of ‘K’ contiguous elements in it.
236+
237+
238+
Input: ![[Pasted image 20220910145630.png]]
239+
Output: ![[Pasted image 20220910145753.png]]
240+
Alg1: Bruteforce return the average for every 5 element
241+
Time: O(N * K)
242+
• Its not optimal because we are calculating the sum of overlapping elements between subarray more than once.
243+
![[Pasted image 20220910150423.png]]
244+
• Why not use a sliding window and substract and add to the sum?
245+
![[Pasted image 20220910150647.png]]
246+
Alg2: Sliding window
247+
248+
249+
229250
## Dynamic Programming
230251

231252
(Programming == tables)

0 commit comments

Comments
 (0)