(・∀・)C/C++の宿題やらせてください。ver10
■ このスレッドは過去ログ倉庫に格納されています
0367361
NGNGこんなのでどうでしょう。
struct BTree {
int data;
struct BTree *left, *right;
};
void insert(struct BTree *at, struct BTree *ins)
{
struct BTree *cur = at;
while (cur != NULL) {
struct BTree *whitch =
ins->data > cur->data? cur->right: cur->left;
if (whitch == NULL) {
whitch = ins;
break;
}
cur = whitch;
}
}
■ このスレッドは過去ログ倉庫に格納されています