0
0
DSA Javascriptprogramming~5 mins

Binary Tree Node Structure in DSA Javascript - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a binary tree node?
A binary tree node is a basic unit of a binary tree that contains data and has up to two child nodes: left and right.
Click to reveal answer
beginner
What are the main parts of a binary tree node?
A binary tree node has three main parts: <br>1. Data (value stored)<br>2. Left child (pointer to left node)<br>3. Right child (pointer to right node)
Click to reveal answer
beginner
Show a simple JavaScript class for a binary tree node.
class TreeNode {<br>  constructor(value) {<br>    this.value = value;<br>    this.left = null;<br>    this.right = null;<br>  }<br>}
Click to reveal answer
beginner
Why do left and right children start as null in a new binary tree node?
Because when a node is created, it has no children yet. Null means no child node connected on that side.
Click to reveal answer
intermediate
How does a binary tree node differ from a linked list node?
A binary tree node has two pointers (left and right), while a linked list node has only one pointer to the next node.
Click to reveal answer
What does a binary tree node typically contain?
AData, left child, right child
BData, next node
COnly data
DData, previous node
In JavaScript, how do you represent a missing child in a binary tree node?
Aundefined
Bnull
C0
Dfalse
Which of these is NOT a part of a binary tree node?
ARight child pointer
BLeft child pointer
CParent pointer
DValue
What is the initial value of left and right children when a node is created?
Anull
B0
Cundefined
Dempty string
How many children can a binary tree node have at most?
A1
B3
CUnlimited
D2
Describe the structure of a binary tree node and its parts.
Think about what each node stores and how it connects to others.
You got /4 concepts.
    Write a simple JavaScript class for a binary tree node and explain why left and right start as null.
    Focus on the code and the meaning of null pointers.
    You got /5 concepts.