## C Program for Activity Selection Problem | Greedy Algo-1

You are given n activities with their start and finish times. Select the maximum number of activities that can be performed by a single person,… Read More »

## C Program for Matrix Chain Multiplication | DP-8

Given a sequence of matrices, find the most efficient way to multiply these matrices together. The problem is not actually to perform the multiplications, but… Read More »

## C Program Coin Change

Given a value N, if we want to make change for N cents, and we have infinite supply of each of S = { S1,… Read More »

## C Program for Minimum number of jumps to reach end

Given an array of integers where each element represents the max number of steps that can be made forward from that element. Write a function… Read More »

## C Program for Min Cost Path

Given a cost matrix cost[][] and a position (m, n) in cost[][], write a function that returns cost of minimum cost path to reach (m,… Read More »

## C / C++ Program for Subset Sum | Backtracking-4

Subset sum problem is to find subset of elements that are selected from a given set whose sum adds up to a given number K. We… Read More »

## C Program for N Queen Problem | Backtracking-3

The N Queen is the problem of placing N chess queens on an N×N chessboard so that no two queens attack each other. For example,… Read More »

## C Program for Rat in a Maze | Backtracking-2

We have discussed Backtracking and Knight’s tour problem in Set 1. Let us discuss Rat in a Maze as another example problem that can be… Read More »

## C/C++ Program for Longest Increasing Subsequence

The Longest Increasing Subsequence (LIS) problem is to find the length of the longest subsequence of a given sequence such that all elements of the… Read More »

## C Program for Rabin-Karp Algorithm for Pattern Searching

Given a text txt[0..n-1] and a pattern pat[0..m-1], write a function search(char pat[], char txt[]) that prints all occurrences of pat[] in txt[]. You may… Read More »

## C Program for KMP Algorithm for Pattern Searching

Given a text txt[0..n-1] and a pattern pat[0..m-1], write a function search(char pat[], char txt[]) that prints all occurrences of pat[] in txt[]. You may… Read More »

## C Program for Naive algorithm for Pattern Searching

Given a text txt[0..n-1] and a pattern pat[0..m-1], write a function search(char pat[], char txt[]) that prints all occurrences of pat[] in txt[]. You may… Read More »

## C Program for Fibonacci numbers

The Fibonacci numbers are the numbers in the following integer sequence. 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ……..… Read More »

## C/C++ Program for n-th Fibonacci number

In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence relation Fn = Fn-1 + Fn-2 with seed values F0 =… Read More »

## C Program for Merge Sort for Linked Lists

Merge sort is often preferred for sorting a linked list. The slow random-access performance of a linked list makes some other algorithms (such as quicksort)… Read More »