void* CopieG(void* g) { int i, n = NrNoduri(g); AG c = (AG)AlocG (n); TCost * s = ((AG)g)->x; if (!c) return NULL; memcpy(c->x, s, n*n*sizeof(TCost)); return (void*)c; }
int NrNoduri(TArb r) /* numarul de noduri din arborele r -*/ { if (!r) return 0; /* arbore vid => 0 noduri */ return 1 + NrNoduri(r->st) + NrNoduri(r->dr); }