small done
parent
8e701f6953
commit
111ab14b37
|
@ -35,7 +35,6 @@ namespace blt
|
||||||
node* left;
|
node* left;
|
||||||
node* right;
|
node* right;
|
||||||
|
|
||||||
|
|
||||||
node(const T& t): val(t)
|
node(const T& t): val(t)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
@ -103,6 +102,7 @@ namespace blt
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
node* search = root;
|
node* search = root;
|
||||||
|
node* parent = nullptr;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if (t < search->val)
|
if (t < search->val)
|
||||||
|
@ -110,7 +110,7 @@ namespace blt
|
||||||
if (search->left == nullptr)
|
if (search->left == nullptr)
|
||||||
{
|
{
|
||||||
search->left = new node(t);
|
search->left = new node(t);
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
search = search->left;
|
search = search->left;
|
||||||
} else
|
} else
|
||||||
|
@ -118,10 +118,11 @@ namespace blt
|
||||||
if (search->right == nullptr)
|
if (search->right == nullptr)
|
||||||
{
|
{
|
||||||
search->right = new node(t);
|
search->right = new node(t);
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
search = search->right;
|
search = search->right;
|
||||||
}
|
}
|
||||||
|
parent = search;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue