DSA QUESTIONS
All binary search trees are balanced - answer False
Which of the traversals in the binary search tree gives a sorted list? - answer In-order
If node K is to be deleted, the value of which node could be used to replace it? More
answers might be correct and you have to choose all of them - answerM, J
What statements are true? More answers might be correct. - answer- In a binary search
tree a new element is always added as a leaf.
- A binary search tree is a tree whose elements are organised to facilitate finding a
particular element when needed.
We consider an AVL tree with 7 nodes and we know that the height of a tree with a
single node is 0. What is the maximum height of our AVL tree? - answer3
Al binary search trees are balanced - answerFalse
BST search, insert, and delete operations typically run in time O(d). What is d? -
answerThe depth of the relevant node in the tree
The number of edges from the node to the deepest leaf is called______ of the tree. -
answerHeight
Which of the traversals in the binary search tree gives a sorted list? - answerIn-order
...........of binary tree starts by visiting the root current node, then its left child and then
its right child - answerPreorder traversal
What does the following piece of code do?
public void func (Tree root)
{
func(root.left());
func(root.right());
System.out.println(root.data());
} - answerPost-order traversal
Which of the following problems is not suitable to be solved with a tree? -
answerUndo/Redo operations in a notepad
All binary search trees are balanced - answer False
Which of the traversals in the binary search tree gives a sorted list? - answer In-order
If node K is to be deleted, the value of which node could be used to replace it? More
answers might be correct and you have to choose all of them - answerM, J
What statements are true? More answers might be correct. - answer- In a binary search
tree a new element is always added as a leaf.
- A binary search tree is a tree whose elements are organised to facilitate finding a
particular element when needed.
We consider an AVL tree with 7 nodes and we know that the height of a tree with a
single node is 0. What is the maximum height of our AVL tree? - answer3
Al binary search trees are balanced - answerFalse
BST search, insert, and delete operations typically run in time O(d). What is d? -
answerThe depth of the relevant node in the tree
The number of edges from the node to the deepest leaf is called______ of the tree. -
answerHeight
Which of the traversals in the binary search tree gives a sorted list? - answerIn-order
...........of binary tree starts by visiting the root current node, then its left child and then
its right child - answerPreorder traversal
What does the following piece of code do?
public void func (Tree root)
{
func(root.left());
func(root.right());
System.out.println(root.data());
} - answerPost-order traversal
Which of the following problems is not suitable to be solved with a tree? -
answerUndo/Redo operations in a notepad