This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream.h> | |
#include<stdio.h> | |
#include<conio.h> | |
int v[10],e[10][10],w[10][10],n,mincost; | |
void Prim() | |
{ | |
v[1]=1; | |
for(int i=1;i<=n;i++) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream.h> | |
#include<stdio.h> | |
#include<conio.h> | |
#include<stdlib.h> | |
#include<time.h> | |
int a[30000],n; | |
void selection_sort() | |
{ | |
int min,i,j; | |
for(i=0;i<n-1;i++) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream.h> | |
#include<stdio.h> | |
#include<conio.h> | |
void main() | |
{ | |
clrscr(); | |
int i,j,n,e[10][10],order[10]={0},ne=0; | |
cout<<"\n Enter the value of n (i.e.), no of vertices:\t"; | |
cin>>n; | |
cout<<"\n Enter the adjacency matrix:\n"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream.h>] | |
#include<stdio.h> | |
#include<stdlib.h> | |
#include<conio.h> | |
int count,comp, e[10][10],n,v[10],order[10]; | |
void dfs(int i) | |
{ | |
v[i]=comp; | |
for(int j=0;j<n;j++) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void InsertionSort(A) | |
for(j = 2;j<=n;j++) | |
{ | |
key = A[j]; | |
i = j -1; | |
while(i > 0 && A[i] > key) | |
{ | |
A[i+1] = A[i]; | |
i = i - 1 ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void gen_primes() | |
{ | |
int i,j; | |
for(i=0;i<MAX;i++) primes[i] = 1; | |
for(i=2;i<=(int)sqrt(MAX);i++) | |
if (primes[i]) | |
for(j=i;j*i<MAX;j++) primes[i*j] = 0; | |
} |
OlderNewer