Skip to content

Commit f593371

Browse files
committed
added random BSTs, dynamic canvas scaling
1 parent ee0a6d3 commit f593371

File tree

4 files changed

+340
-265
lines changed

4 files changed

+340
-265
lines changed

src/components/BST.astro

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
---
2-
---
3-
4-
<div class="tree">
1+
<div id="tree">
52
<canvas id="main-canvas">
63

74
</canvas>
85
</div>
96
<style>
10-
.tree {
7+
#tree {
118
display: flex;
129
flex-direction: column;
1310
gap: 20px;

src/pages/index.astro

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,19 @@ import { Icon } from 'astro-icon/components'
3232
<input class="submit-button" type="submit" value="Remove">
3333
</form>
3434
</InfoPanel>
35+
<InfoPanel>
36+
<h2>Generate Random Binary Tree</h2>
37+
<form id="random-form" onsubmit="return false;" method="post" name="myForm2">
38+
<div>
39+
<label for="fname">Number of nodes (max 20)</label>
40+
<input id="random-form-input" type="text" name="fname" placeholder="Input any integer" required />
41+
</div>
42+
<input class="submit-button" type="submit" value="Random">
43+
</form>
44+
</InfoPanel>
3545
<InfoPanel>
3646
<h2>PreOrder Representation</h2>
3747
<code id="preorder-list"></code>
38-
<Button>Preorder Traversals</Button>
3948
</InfoPanel>
4049
<InfoPanel>
4150
<h2>InOrder Representation</h2>

0 commit comments

Comments
 (0)