Skip to main content

Mathematical for Data Structures and Algorithmss

The mathematical unit covers number tricks and bit manipulation used in algorithm problems, together with complexity analysis and interview strategy. Topics include modular arithmetic, gcd, primes, XOR and bit masks, Big-O reasoning, and a repeatable routine for clarifying, solving, testing and explaining a problem under time pressure.

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

What to learn in Mathematical

Mathematical interview questions

How does XOR help find the unique element in an array where others appear twice?

XOR of a number with itself is zero, and XOR with zero returns the number. XORing every element cancels all pairs and leaves the unique value, in O(n) time and O(1) space, regardless of the order of elements.

What does amortised O(1) mean for appending to a dynamic array?

Most appends cost O(1), but occasionally the array resizes and copies all elements at O(n). Because resizing doubles capacity, those costly steps are rare, and the average cost per append over many operations stays constant.

Where Mathematical fits in the Data Structures and Algorithms roadmap

Mathematical belongs to the Advanced stage (advanced level), which takes about 32 hours. Optimisation.

Back to the full Data Structures and Algorithms roadmap