codice:
struct node {
double *cluster; //etichetta contenente il vettore di punti, o meglio matrice(n,3)
struct node *right; //puntatore al sottoalbero destro
struct node *left; //puntatore al sottoalbero sinistro
}NODE;
typedef NODE* tree;
tree Costruisci_Albero(double *tag, tree S, tree D) {
tree root = (struct node*) malloc(sizeof(NODE));
assert(root != NULL);
root->cluster = tag;
root->left = S;
root->right = D;
return root;
};
codice:
int main(void){
tree root = NULL;
double *array = NULL;
int n;
//... input n ...
array = malloc(n * 3 * sizeof(double));
assert(array != NULL);
root = Costruisci_Albero(array, NULL, NULL);
return 0;
}