Here is the implementation of Breadth First Search in C++ , which we discussed in the last post. As,we said in last post, BFS is used to calculate the shortest distance, the distance matrix here actually takes care of that. Check the BFS, on the graph discussed in the previous post, and verify the distance […]

Breadth-first search is one of the simplest algorithms for searching a graph. Prim’s minimum-spanning- tree algorithm and Dijkstra’s single-source shortest-paths algorithm use ideas similar to those in breadth-first search. Given a graph G(V,E) and a distinguished source vertex s, breadth-first search systematically explores the edges of G to “discover” every vertex that is reachable from […]

In the Factorials and Trailing Zeroes post, we have discussed a simple technique on how to calculate trailing zeros of a factorial. But What if, you want to calculate 100! result, instead of trailing zeros..? The result of 100! is about 150 decimal digits, the maximum number we can store in an integer is of […]

In mathematics, binomial coefficients are a family of positive integers that occur as coefficients in the binomial theorem. They are indexed by two non-negative integers. The binomial coefficient indexed by n and k is usually written as It is the coefficient of the x^k term in the polynomial expansion of the binomial power (1 + […]


Get every new post delivered to your Inbox.

Join 33 other followers