View on GitHub

advent-of-code-2024

Readable Advent of Code 2024 algorithms and solutions in C language

Day 4: Ceres Search

Let $\mathbf{A}=(a_{i,j})$ be an $m\times n$ matrix and $\mathbf{v}$ be a $k$-element vector.

Part A

Algorithm 1:

Algorithm 2 with coordinate $i,j$ and coordinate $\mathrm{d}i,\mathrm{d}j$ as arguments:

Time complexity: $O(kmn)=O(mn)$ for small $k$.

Space complexity: $O(1)$.

Part B

Algorithm 3:

Time complexity: $O(kmn)=O(mn)$ for small $k$.

Space complexity: $O(1)$.