analysis and devlopment of alogoritham

Upload: anonymous-ecrzqeb

Post on 06-Jan-2016

218 views

Category:

Documents


0 download

DESCRIPTION

Analysis and Devlopment of AlogorithamAnalysis and Devlopment of AlogorithamAnalysis and Devlopment of AlogorithamAnalysis and Devlopment of Alogoritham

TRANSCRIPT

PROGRAM 5Implementation of a knapsack problem using dynamic programming.#include< stdio.h >#include< conio.h >#define MAX 20

void knapsack(int,int); int max(int,int);void backtracking();int weight[MAX],value[MAX],W,n,*x; int v[MAX][MAX];

void main(){

int i,j; clrscr();

printf("\n Enter number of Object you want:"); scanf("%d",&n);

printf("\n Enter weight and values in ascending order of vales"); for(i=1;i