Skip to content

Commit aed1a6e

Browse files
author
myselfshravan
committed
p and d
1 parent a9edac2 commit aed1a6e

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

11.dijkstras.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#include <stdio.h>
2+
#include <stdlib.h>
23
#define INFINITY 9999
34
#define MAX 10
5+
46
void dijkstra(int G[MAX][MAX], int n, int startnode);
57

68
int main()

3.Bubble_Insertion.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ void insertionSort(int *array, int size)
2323
for (int i = 1; i < size; i++)
2424
{
2525
key = array[i]; // take value
26-
j = i;
26+
j = i; // take index
2727
while (j > 0 && array[j - 1] > key)
2828
{
2929
array[j] = array[j - 1];

9.prims.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
11
#include <stdio.h>
22
#include <stdlib.h>
3-
43
#define infinity 9999
54
#define MAX 20
65

7-
int G[MAX][MAX], spanning[MAX][MAX], n;
8-
9-
int prims();
6+
int prims(int G[MAX][MAX], int spanning[MAX][MAX], int n);
107

118
int main()
129
{
10+
int G[MAX][MAX], spanning[MAX][MAX], n;
1311
int i, j, total_cost;
1412
printf("Enter no. of vertices: ");
1513
scanf("%d", &n);
1614
printf("\nEnter the adjacency matrix: \n");
1715
for (i = 0; i < n; i++)
1816
for (j = 0; j < n; j++)
1917
scanf("%d", &G[i][j]);
20-
total_cost = prims();
18+
total_cost = prims(G, spanning, n);
2119
printf("\nspanning tree matrix:\n");
2220
for (i = 0; i < n; i++)
2321
{
@@ -29,7 +27,7 @@ int main()
2927
return 0;
3028
}
3129

32-
int prims()
30+
int prims(int G[MAX][MAX], int spanning[MAX][MAX], int n)
3331
{
3432
int cost[MAX][MAX];
3533
int u, v, min_distance, distance[MAX], from[MAX];

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy