Skip to main content

Algorithms

As it is known that algorithms and data structures are the prime of computer programming. With algorithms and data structures, the better high-level features in applications we can develop and implement. Outstanding algorithms means faster time and less space. O(1) on both of time complexity and space must be the best as taking the constant time and the constant space, but it's rarely to achieve in practice. Next, O(log n) is mostly desirable for most applications on real occasion.

Of course, you'll go through algorithms questions in a lot of interviews for programming-related positions.

Here are proofs for the correctness of some common algorithms, that I'd like to understand and prove them in mathematics.

Boyer–Moore majority vote algorithm

Just run one loop to find the majority in an array.

Time complexity: O(n) Space complexity: O(1)

Resources