Sliding Window Flashcards
1
Q
What two types of windows are there
A
variable and fixed
2
Q
How do we keep sliding window o(n)?
A
the left and the right pointers should only traverse the array once.
3
Q
what operations happen in a variable size sliding windo
A
each element is at most processed twice, once when expanding and once when contracting
3
Q
what operations happen in fixed-size sliding window
A
each element is added to the windo once and removed once
4
Q
list out the various techniques for sliding window and their runtimes
A
Fixed size sliding window o(n)
Variable size sliding window o(n)
Sliding Window with Deque o(n)
Sliding Window with Sorting Heap o(n)