Search via Sliding Window in 1D Array

In this lesson, we will explore the phenomenon of traversing (1D) arrays via a specific fixed-sized window.

Given a jump of any specific number of cells (let’s call it stride), we can both mutually exclusively and inclusively slide a fixed-sized window over the array.

Sliding window traversal

We’ll start with the mutually inclusive windows first. By the mutually inclusive window, we mean some values of the previous window are also present in the next window.

Look at the illustration to see what we mean by mutually inclusive.

Get hands-on with 1200+ tech skills courses.