> //contractia grafului#include <stdio.h>#include <conio.h>void main(){ int n,m1,m2,i,j, a[29][29]; //citire n si matrice din fisier …
Dragos Schiopu
Dragos Schiopu
Pasionat de tehnologie, curios, de mic demontam orice jucarie electrica/electronica sau care avea butoane. Pe ce puneam mana stricam, astazi se cheama ca le testez.
-
-
>Componente conexe intr-un graf //ptr un varf k, se ia linia si coloana k din …
-
> #include <stdio.h>#include <conio.h>int a[20][20],i,j,n,colorat[20],nrculori=0,nr=0;void citire(){ FILE *f=fopen("c:date3.txt","r"); fscanf(f,"%d",&n); for (i=1;i<=n;i++) for (j=1;j<=n;j++) fscanf(f,"%d",&a[i][j]); fclose(f);}void …
-
>Parcurgerea BF a unui graf #include <stdio.h>#include <conio.h>int a[20][20],n,i,j,vf_init,coada[20],vizitat[20],vf_curent,prim,ultim;/*n – nr de varfurivf_init – varful …
-
>Pentru ca am vazut ca foarte multi cauta pe Google „turnurile din hanoi in php” …
-
> //algoritmul Bellman-Ford#include<stdio.h>#include<conio.h>int a[20][20],d[20],r,n,i,j;void citire(void){FILE *f=fopen(„c:in.txt”,”r”);fscanf(f,”%d”,&n);for(i=1;i<=n;i++) for(j=1;j<=n;j++) fscanf(f,”%d”,&a[i][j]);fclose(f);}void main(){citire();printf(„Dati nodul initial r=”);scanf(„%d”,&r);//se copiaza linia r …
-
> //se afiseaza arcele incidente spre exterior/interior ale varfului i#include <stdio.h>#include <conio.h>void main(void){int a[50][50],n,i,j;FILE *f=fopen(„c:intrare.txt”,”r”);fscanf(f,”%d”,&n); …
-
> //Arbori (alocare dinamica) – parcurgerile RSD, SRD si SDR#include <stdio.h>#include <conio.h>#include <alloc.h>struct arbore{int inf;arbore …
-
> //parcurgerea unei matrici in spirala#include #include #include void citire(int m, int n, int a[20][20],char …
-
> //suma cifrelor unui numar//cifra de control#include #include #include int suma_cifrelor(int numar){int suma=0;do { suma=suma+numar%10; …