Dynamic Programming

Bellman-Ford Algorithm in C and C++

Here you will learn about Bellman-Ford Algorithm in C and C++. Dijkstra and Bellman-Ford Algorithms used to find out single source shortest paths. i.e. there is a source node, from that node we have to find shortest distance to every other node. Dijkstra algorithm fails when graph has negative weight cycle. But Bellman-Ford Algorithm won’t fail …

Bellman-Ford Algorithm in C and C++ Read More »

C Program for Longest Common Subsequence Problem

In this post I am sharing C program for Longest Common Subsequence Problem. LCS problem is a dynamic programming approach in which we find the longest subsequence which is common in between two given strings. A subsequence is a sequence which appears in the same order but not necessarily contiguous. For example ACF, AFG, AFGHD, …

C Program for Longest Common Subsequence Problem Read More »