Skip to main content

Windows and Lists for Data Structures and Algorithmss

Windows and lists covers the sliding window technique, which maintains a moving range over an array or string to answer subarray questions in linear time, and linked lists, where nodes hold pointers to the next node. Common tasks include reversing a list, detecting cycles and finding the longest valid substring.

Stage: Linear Structures · Part of the Data Structures and Algorithms roadmap · Last reviewed 19 November 2026

What to learn in Windows and Lists

Windows and Lists interview questions

How does Floyd's cycle detection work on a linked list?

Two pointers move through the list, one step and two steps at a time. If the list has a cycle, the faster pointer eventually catches the slower one inside it. If either reaches null, there is no cycle. It uses O(1) extra space.

When should you use a sliding window instead of brute force?

Use it when you need a contiguous subarray or substring satisfying a condition, and extending or shrinking the range updates the answer cheaply. It replaces re-scanning every start and end pair, cutting O(n squared) work to O(n).

Where Windows and Lists fits in the Data Structures and Algorithms roadmap

Windows and Lists belongs to the Linear Structures stage (intermediate level), which takes about 43 hours. Sequences.

Back to the full Data Structures and Algorithms roadmap