Post

Algorithmic Patterns

An algorithmic pattern is a common problem-solving strategy or technique used to solve a class of algorithmic problems efficiently by recognizing and reusing a specific approach or structure. These patterns help in simplifying complex problems by providing reusable logic templates.

Algorithmic Patterns

Prefix Sum

A prefix sum array, also known as a cumulative sum array, is a derived array that stores the cumulative sum of elements in a given array. Each element in the prefix sum array represents the sum of all elements up to that index in the original array. It acts as a precursor to answering queries related to cumulative sums, allowing for fast and efficient computations.

Prefix Sum

Two Pointers

In the two pointers method, two pointers are used to iterate through the array values. Both pointers can move to one direction only, which ensures that the algorithm works efficiently.

This post is licensed under CC BY 4.0 by the author.