2022-05-07 16:54:28 +02:00
|
|
|
let recorder = new Recorder(d3.select("#graph").graphviz(), "graph");
|
2022-05-06 09:42:13 +02:00
|
|
|
|
2022-05-07 16:54:28 +02:00
|
|
|
let tree = new WAVLTree();
|
2022-05-01 17:10:24 +02:00
|
|
|
tree.recorder = recorder;
|
|
|
|
|
|
|
|
function insertCallback() {
|
|
|
|
let number = document.getElementById("insertInput").value;
|
|
|
|
if (number === "") {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
let value = parseInt(number);
|
|
|
|
tree.insert(value);
|
|
|
|
|
|
|
|
document.getElementById("insertInput").value = "";
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
function deleteCallback() {
|
|
|
|
let number = document.getElementById("deleteInput").value;
|
|
|
|
if (number === "") {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
let value = parseInt(number);
|
|
|
|
tree.delete(value);
|
|
|
|
|
|
|
|
document.getElementById("deleteInput").value = "";
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
function render() {
|
|
|
|
recorder.render();
|
|
|
|
setTimeout(render);
|
|
|
|
}
|
|
|
|
render();
|