• 1000 это потому что теперь мне нужно go вернуться к
Root
->
M
->
L
.
Любая помощь будет принята с благодарностью.
public void insert(client client) {
if (root == null) {
root = client;
return;
}
client curr = root;
client parent;
while (true) {
parent = curr;
curr = parent.getLc();
if (curr.getLc() == null) {
curr.setLc(client);
return;
} else if (curr.getMc() == null) {
curr.setMc(client);
return;
} else if (curr.getRc() == null) {
curr.setRc(client);
return;
}
curr = parent.getMc();
{
if (curr.getLc() == null) {
curr.setLc(client);
return;
} else if (curr.getMc() == null) {
curr.setMc(client);
return;
} else if (curr.getRc() == null) {
curr.setRc(client);
return;
}
}
curr = parent.getRc();
if (curr.getLc() == null) {
curr.setLc(client);
return;
} else if (curr.getMc() == null) {
curr.setMc(client);
return;
} else if (curr.getRc() == null) {
curr.setRc(client);
return;
}
}
}