/*Output Pattern found at index 0 Pattern found at index 9 Pattern found at index 13 */ Advertisements

# Category: Analysis of Algorithms

## Optimal Binary Search Tree

/*Output Enter the number of elements:6 Enter the Element of 1:10 Enter the Element of 2:3 Enter the Element of 3:9 Enter the Element of 4:2 Enter the Element of 5:0 Enter the Element of 6:10 Enter the Probability of 0:5 Enter the Probability of 1:6 Enter the Probability of 2:4 Enter the Probability of…… Continue reading Optimal Binary Search Tree

## All Pair Shortest Path

/*OUTPUT: Enter the number of vertices: 3 Enter the number of edges: 5 Enter the end vertices of edge 1 with its weight 1 2 4 Enter the end vertices of edge 2 with its weight 1 3 11 Enter the end vertices of edge 3 with its weight 2 1 6 Enter the end…… Continue reading All Pair Shortest Path

## Robin-Karp String Matching

/*Output Pattern Naruto found in text: Naruto is the best !! Naruto Daisuki at index 0 Pattern Naruto found in text: Naruto is the best !! Naruto Daisuki at index 22 */

## N – Queens Problem

/*output Enter the number of queens: 4 1 -Q– —Q Q— –Q- 2 –Q- Q— —Q -Q– Total solution for N=4 –> 2 */

## Sum of Subsets

/*Output Enter number of elements 6 Enter elements 5 10 12 13 15 18 Enter sum to be computed 30 Subsets whose sum is are as follows Elements of set are 5 10 15 Elements of set are 5 12 13 Elements of set are 12 18 */

## Single Source Shortest Path (Bellman Ford)

/*Output Enter no. of vertices: 5 Enter adjacency : 0 6 0 7 0 0 0 5 8 -4 0 -2 0 0 0 0 0 -3 0 9 2 0 7 0 0 Enter source: 1 Vertex 1 -> cost = 0 parent = 0 Vertex 2 -> cost = 2 parent = 3…… Continue reading Single Source Shortest Path (Bellman Ford)