Sliding Window Flashcards

1
Q

What two types of windows are there

A

variable and fixed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do we keep sliding window o(n)?

A

the left and the right pointers should only traverse the array once.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what operations happen in fixed-size sliding window

A

each element is added to the windo once and removed once

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly