Treceți la conținutul principal

prim cpp


int max = 10
int infint = 10000
int c[max][max]
int n,j,i,k

int min
int vecin[max]

cin n;

for i = 1 to n-1 do
 for j = i+1 to n 
  cout c[i][j] 
  cin c[i][j]
  if c[i][j] = 0 then c[i][j] = infinit
  c[j][i] = c[i][j] 

c[i][j] = 0

for i = 0 to n vecin[i]=1

vecin[i] = 0

for pas = 2 to n

// B
 min = infinit
  for i = 1 to n
   if vecin[i]!=0 then
    if c[i][vecin[i]] < min then
     min = c[i][vecin[i]]
     k = I

// C

cout k
cout vecin[k]

cost = cost + c [k][vecin[k]]

// D
vecin [k] = 0

for i = 2 to n 
 if vecin [i] != 0 then
  if c[i][vecin[i]] > c[i][k] then vecin [i]=k

cout cost


vecin []
  vecin[i] = 0   
   arbore partial construit
  vecin [i] != 0 
   varful i nu este in arbore iar prima muchie (i,v) cu v in arborel (i,v0) are costul cel mai mic

1.vf 1->arbore => vecinn all

 fie 1,2,...,b in A

2.pasii n-1

 - muchia cu cel mai mic cost in afar arborelui  (i) se celalalt varf in arborele vecin [i] pt a avea cea mai mica muchie dintre cele ce le formeaza i cu vf in arborele deja format i fie in aceasta muchie (k, vecin[k]) : B

 -se adauga muchia (k,vecin[k]) la arborele si se actualizeaza costul C
 -se actualizeaza vecin[] in conformitate cu definitia s0 (D)
  pt celelalte vf  ramase in afara arborelui se ver daca muchia (i,k) nu este mai mica decat muchia veche (i,vecin[i]) care
 legea pe i de arbore i ncaz afrimativ punandu-se vecin[i]=k;


Postări populare de pe acest blog


good news : a BIOS UPDATE can resolve the problem but just for a Windows 7 on 64 bits o.s. and the system is not stable all the time. even after  bios update the system can freeze.
new info : u can try to low the screen brightness and see if this error appear so often after 
news: last info !!! maybe a virus. scann our system now with an antivirus i generate this error using other device ( a tablet pc) connected in the same network and the laptop i have this problem just freeze

news : if u use a tenda router this make couse all this problems

what i discover so far :
1.the electric company have many failure and affect the main ISP router/switch for building  also the router/switch installed by the ISP may be affected by overheating and will crash after a long utilisation on heat conditions 2.the router/switch of ISP affect any router of the user between this router and pc/laptop of client 3.the router and any other device of t…

program principal cpp

#include "clasa.h" #include <stdio.h> #include <conio.h> #include <stdlib.h> #include <string.h> #define DELAY 9000000 void delay() { for(long i=0;i<DELAY;i++); } //constructor cu initializare de la tastatura BigInt::BigInt() {char x; signed char t[400]; int i; printf("\nNumarul cu semn "); do s=getche(); while((s!='+')&&(s!='-')); n=0; do {x=getche(); t[n]=x-'0'; n++; } while((x>='0')&&(x<='9')); n--; for(i=0;i<n;i++) nr[i]=t[n-i-1]; } //constructor cu initializare prin parametri BigInt::BigInt(char semn,signed char numar[],int dim) {int i; s=semn; n=dim; for(i=0;i<n;i++) nr[i]=numar[n-i-1]; } //transform un int negativ in pozitiv int BigInt::Pozitiv(int x) {int a,vb; a=0; vb=0; while(vb==0) if((x+a)==0) vb=1; else a=a+1; x=a; return x; } //constructor dintr-un nr int obisnuit BigInt::BigInt(int x) {int i; if(x>=0) s='+'…

o aplicatie php localitati romania



/* dragtable v1.0 June 26, 2008 Dan Vanderkam, \Bsortabledraggable\B Instructions: - Download this file - Add <script src="dragtable.js"></script> to your HTML. - Add class="draggable" to any table you might like to reorder. - Drag the headers around to reorder them. This is code was based on: - Stuart Langridge's SortTable ( - Mike Hall's draggable class ( - A discussion of permuting table columns on comp.lang.javascript Licensed under the MIT license. */ // Here's the notice from Mike Hall's draggable script: //***************************************************************************** // Do not remove this notice. // // Copyright 2001 by Mike Hall. // See http…