ALGORITHMS

Problem Source: UVA Online Judge - 567

Brief Analysis: As a first problem of Floyd-Warshall, a very straight-forward problem chosen. Just read and code.

Continue reading...

Problem Source: UVA Online Judge - 10986

Brief Analysis: As a first problem of Dijkstra, a very straight-forward problem chosen. Just read and code.

Continue reading...

Problem Source: UVA Online Judge - 10067

Brief Analysis: It could be easily identified this is a BFS problem. Only one optimization here is to build graph first time before running any test case. Building graph for each test case could get TLE verdict.

Continue reading...

Solving graph problems for newbies was never been easy. In this series of blog, I am going to delineate solutions of graph problems precisely taken from several online judges which will help newbies to solve graph problem from easy to hard categories. Although It's good to have a theoritical backgro...

Continue reading...

Bitwise GCD:

Bitwise GCD is applicable only for unsigned int. It's 60% faster than normal numeric gcd algorithm. The quick short implementation of bitwise GCD is:

public int gcd(int a, int b) {
    while(b) b ^= a ^= b ^= a % b;
    return a;
}

Ref: https://en.wikipedia.org/wiki/Binary_GCD_a...

Continue reading...