Source Code:
#include<iostream.h>
#include<conio.h>
void main()
{clrscr();
int g[10][10],n,i,j,k;
cout<<"program for Floyd warshall (all pair shortest path)by: Tarun rawat\n\n";
Welcome to " way2cplusplus.blogspot.in " Objective of this blog is to implement various Computer Science Engineering Lab problems into C++ programming language. These are basically most common Lab Exercise problems based on the curriculum of engineering colleges throughout the Nation. These lab exercises are also relevant to Data structure. Simply C++ programming zone...
Showing posts with label ADA. Show all posts
Showing posts with label ADA. Show all posts
Quick Sort
Source Code:
#include<iostream.h>
#include<conio.h>
void quicksort(int*,int,int);
int partion(int*,int,int);
void main()
{clrscr();
cout<<"Enter ten number for quick sort by-Tarun rawat:\n\n";
#include<iostream.h>
#include<conio.h>
void quicksort(int*,int,int);
int partion(int*,int,int);
void main()
{clrscr();
cout<<"Enter ten number for quick sort by-Tarun rawat:\n\n";
Heap Sort (using random input)
Source Code:
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
#include<math.h>
#define MAXSIZE RAND_MAX
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
#include<math.h>
#define MAXSIZE RAND_MAX
0/1 Knapsack Problem
Given weights and values of n items, put these items in a knapsack of capacity W to get the maximum total value in the knapsack. In other words, given two integer arrays val[0..n-1] and wt[0..n-1] which represent values and weights associated with n items respectively. Also given an integer W which represents knapsack capacity, find out the maximum value subset of val[]
Job Scheduling
Source Code:
#include<iostream.h>
#include<conio.h>
void job(int*,int*,int,int);
void main()
{clrscr();
cout<<"Program created by Tarun Rawat Job Scheduling\n\n";
#include<iostream.h>
#include<conio.h>
void job(int*,int*,int,int);
void main()
{clrscr();
cout<<"Program created by Tarun Rawat Job Scheduling\n\n";
Fractional Knapsack
There are n items in a store. For i =1,2, . . . , n, item i has weight wi > 0 and worth vi > 0. Thief can carry a maximum weight of W pounds in a knapsack. In this version of a problem the items can be broken into smaller piece, so the thief may decide to carry only a fraction xi of object i, where 0 ≤ xi ≤ 1. Item i contributes xiwi to the total weight in the knapsack, and xivi to the value of the load.here
are n items in a store.
Multiply Matrices by Strassen's Method
C++ Program to multiply matrix using Strassen's
Multiplication method. This program calculates the multiplication of 2 matrices by Strassen's
Multiplication method. We define a 3 arrays : 'a' , 'b' & 'c' , all
of int type. All 3 are input by the user. The number of rows &
columns are made fix to 2. Then the multiplication is calculated by
using strassen's method and the new multiplied matrix is printed on the
screen.
Selection sort in C++
C++ program for selection sort to sort numbers. This code implements selection sort algorithm to arrange numbers of an array in ascending order. With a little modification it will arrange numbers in descending order.
C++ program for binary search
This code implements binary search in c ++language. It can only be used for sorted arrays, but it's fast as compared to linear search. If you wish to use binary search on an array which is not sorted then you must sort it using some sorting technique say merge sort and then use binary search algorithm to find the desired element in the list. If the element to be searched is found then its position is printed.
Linear search in C++
The following code implements linear search (Searching algorithm) which is used to find whether a given number is present in an array and if it is present then at what location it occurs. It is also known as sequential search. It is very simple and works as follows: We keep on comparing each element with the element to search until the desired element is found
Insertion Sorting
C++ program for insertion sort to sort numbers. This code implements insertion sort algorithm to arrange numbers of an array in ascending order. With a little modification it will arrange numbers in descending order.
Subscribe to:
Posts (Atom)











