split into 3 steps
This commit is contained in:
@@ -365,16 +365,26 @@ function nextstep() {
|
||||
stage.find('#nullptr').show();
|
||||
layer.draw();
|
||||
}else if(key == 5){
|
||||
if(pc==1){
|
||||
// highlight 7.5
|
||||
stage.find('#node_'+7.5).fill("orange");
|
||||
layer.draw();
|
||||
pc = pc + 1;
|
||||
}else if(pc==2)
|
||||
// move 7.5 to 5
|
||||
stage.find('#node_'+7.5).x(650);
|
||||
stage.find('#node_'+7.5).y(100);
|
||||
stage.find('#node_text_'+7.5).x(645);
|
||||
stage.find('#node_text_'+7.5).y(90);
|
||||
// hide 7.5 node, and show a NULL pointer.
|
||||
layer.draw();
|
||||
pc = pc + 1;
|
||||
}else if(pc==3){
|
||||
// and then hide 7.5 node, and show a NULL pointer.
|
||||
stage.find('#nullptr').x(770);
|
||||
stage.find('#nullptr').y(390);
|
||||
stage.find('#nullptr').show();
|
||||
layer.draw();
|
||||
}
|
||||
}else if(key == 8){
|
||||
line5.hide();
|
||||
stage.find('#node_'+key).hide();
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<body>
|
||||
|
||||
<h1>Recursive Program: Delete a Node in a Binary Search Tree</h1>
|
||||
<p>This animation shows how to delete a node in a binary search tree. Click the "next step" button to run the animation. <b>Note:</b> This animation as of now doesn't support the deletion of node 5.</p>
|
||||
<p>This animation shows how to delete a node in a binary search tree. Click the "next step" button to run the animation.</p>
|
||||
|
||||
<label>delete node</label> <input type="text" id="textIn"><button onclick="start()">Start</button>
|
||||
<br>
|
||||
|
||||
Reference in New Issue
Block a user