2022-05-15 17:53:12 +02:00
|
|
|
let recorder = new Recorder(
|
|
|
|
d3.select("#graph").graphviz(),
|
|
|
|
document.getElementById("comment"),
|
|
|
|
"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;
|
|
|
|
}
|
|
|
|
|
2022-05-16 15:58:46 +02:00
|
|
|
function switchTree(TreeType) {
|
|
|
|
tree = new TreeType();
|
|
|
|
tree.recorder = recorder;
|
|
|
|
recorder.clear();
|
|
|
|
tree.record("");
|
|
|
|
}
|
|
|
|
|
2022-05-01 17:10:24 +02:00
|
|
|
function render() {
|
|
|
|
recorder.render();
|
|
|
|
setTimeout(render);
|
|
|
|
}
|
|
|
|
render();
|