Important algorithms

This covers some of the well know algorithms based on the survey.

Sieve for Prime


SieveOfEratosthenes(n)
    prime be array of size n and set to true
    for (int p=2; p*p<=n; p++)
        if (prime[p] == true)
            for (int i=p*p; i<=n; i += p)
            prime[i] = false;

Fenwick Tree