# Category Archives: 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… Read More »

## Matrix Chain Multiplication in C and C++

Here you will learn about Matrix Chain Multiplication with example and also get a program that implements matrix chain multiplication in C and C++. Before going to main problem first remember some basis. We know that, to multiply two matrices it is condition that, number of columns in first matrix should be equal to number of… Read More »

## Travelling Salesman Problem in C and C++

Here you will learn about Travelling Salesman Problem (TSP) with example and also get a program that implements Travelling Salesman Problem in C and C++. Let say there are some villages (1, 2, 3, 4, 5). To work with worst case let assume each villages connected with every other villages. And there is a Salesman living… 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,… Read More »