Advance Data Structure Quiz-c-1

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By ADS11
A
ADS11
Community Contributor
Quizzes Created: 5 | Total Attempts: 665
| Attempts: 152 | Questions: 15
Please wait...
Question 1 / 15
0 %
0/100
Score 0/100
1. If we first delete a key from an R-B tree and add it back then, how does the structure of resulting R-B tree compare with original R-B tree?

Explanation

The structure of the resulting R-B tree may be the same or different depending on the case because the deletion and re-insertion of a key can have different effects on the tree. If the key being deleted and added back does not affect the balance of the tree, then the resulting tree will be the same as the original. However, if the key being deleted and added back causes any restructuring or rebalancing of the tree, then the resulting tree will be different from the original. Therefore, it is not guaranteed that both trees will always be the same or always be different.

Submit
Please wait...
About This Quiz
Advance Data Structure Quiz-c-1 - Quiz

This 'Advance Data Structure Quiz-C-1' assesses knowledge on various advanced data structures such as Red-Black Trees and 2-3 Trees. It covers properties, operations, and comparisons of tree structures,... see moreoffering insights into their complexity and behavior, crucial for advanced understanding in computer science. see less

2. If we first delete a key from 2-3 tree and then add it back then, how does the structure of resulting 2-3 tree compare with original 2-3 tree?

Explanation

When a key is deleted from a 2-3 tree and then added back, the resulting structure of the tree can be the same as the original tree or it can be different, depending on the case. This is because the structure of a 2-3 tree depends on the specific keys that are inserted and deleted. If the key that is deleted and added back is in a position that causes a restructuring of the tree, then the resulting tree will be different. However, if the key can be inserted back into the tree without causing any restructuring, then the resulting tree will be the same as the original tree. Therefore, both scenarios are possible.

Submit
3. The following are the case of ...................in red black Tree

Explanation

The given correct answer, "Delete," suggests that the cases mentioned (insert, find, delete) are all related to operations performed on a red-black tree. In a red-black tree, the delete operation involves removing a node from the tree while maintaining the properties of a red-black tree, such as the color balance and ordering of the nodes. Therefore, the cases mentioned are specifically referring to the different scenarios that can occur during the deletion process in a red-black tree.

Submit
4. A 2-3 is a tree such that a) All internal nodes have either 2 or 3 children b) All path from root to leaves have the same length The number of internal nodes of a 2-3 tree having 9 leaves could be

Explanation

A 2-3 tree is a tree where all internal nodes have either 2 or 3 children. In this case, we are looking for the number of internal nodes in a 2-3 tree with 9 leaves. Since each internal node has either 2 or 3 children, the number of internal nodes must be less than or equal to the number of leaves divided by 2. In this case, 9 leaves divided by 2 is 4.5, so the number of internal nodes could be 4.

Submit
5. Which type of traversal of binary search tree outputs the value in sorted order?

Explanation

In-order traversal of a binary search tree outputs the values in sorted order because it visits the left subtree first, then the root node, and finally the right subtree. This ensures that the values are visited in ascending order, resulting in a sorted output.

Submit
6. The tree is an example of 

Explanation

A binary search tree is a data structure in which each node has at most two children, and the left child is always smaller than the parent while the right child is always larger. This property allows for efficient searching, insertion, and deletion operations. The given tree is an example of a binary search tree because it follows the defined property, with smaller values on the left and larger values on the right.

Submit
7. Suppose a binary tree is constructed with n nodes, such that each node has exactly either zero or two children. The maximum height of the tree will be?

Explanation

The maximum height of a binary tree with n nodes, where each node has either zero or two children, can be calculated using the formula (n-1)/2. This formula holds true because in a binary tree, each node has at most two children. Therefore, the number of edges in the longest path from the root to a leaf node is equal to the height of the tree. Since each node has either zero or two children, the number of edges will be one less than the number of nodes. Hence, the formula for the maximum height is (n-1)/2.

Submit
8. The height of a BST is given as h. Consider the height of the tree as the no. of edges in the longest path from root to the leaf. The maximum no. of nodes possible in the tree is?  

Explanation

The given answer, 2^(h+1)-1, is the formula for calculating the maximum number of nodes possible in a binary search tree (BST) of height h. This formula is derived from the fact that at each level of the BST, the number of nodes doubles. The height of the tree is the number of levels minus one, so by raising 2 to the power of (h+1) and subtracting 1, we get the maximum number of nodes in the tree. Therefore, the correct answer is 2^(h+1)-1.

Submit
9. The rotation need to be done is

Explanation

The correct answer is LL, which stands for Left-Left rotation. In a binary search tree, LL rotation is performed when a node's left child has a left child. This rotation helps in maintaining the balance of the tree by making the left child the new root and the original root as its right child. This ensures that the tree remains sorted and allows for efficient search and retrieval operations.

Submit
10. For a 2 -3 Tree which of the following is true

Explanation

In a 2-3 Tree, the maximum number of children that any node can have is 3. This means that a node in a 2-3 Tree can have either 2 or 3 children. This property allows for efficient balancing of the tree and ensures that the tree remains balanced even after insertions and deletions.

Submit
11. The run time for traversing all the nodes of a binary search tree with n nodes and printing them in an order is

Explanation

The correct answer is O(nlg(n)) because in order to traverse all the nodes of a binary search tree, we need to visit each node exactly once. This requires a time complexity of O(n). Additionally, printing the nodes in order also takes O(n) time. Therefore, the overall time complexity is O(n) for traversing and printing. However, since the binary search tree is balanced, the height of the tree is approximately lg(n). As a result, the time complexity becomes O(n * lg(n)), which is the most efficient option among the given choices.

Submit
12. Suppose we have numbers between 1 and 1000 in a binary search tree and want to search for the number 363. Which of the following sequence could not be the sequence of the node examined?

Explanation

not-available-via-ai

Submit
13. Which of the following trees have height as O(lgn) where number of nodes is n.

Explanation

An R-B Tree has a height of O(lgn) where the number of nodes is n. This means that as the number of nodes in the tree increases, the height of the tree will increase logarithmically. This property makes R-B Trees efficient for operations such as insertion, deletion, and searching, as the height of the tree remains relatively small even with a large number of nodes. On the other hand, Binary Search Trees, Binary Trees, and 2-3 Trees do not have a guaranteed height of O(lgn) and can have a height of O(n) in the worst case, resulting in less efficient operations.

Submit
14. If n numbers are to be sorted in ascending order in O(nlogn) time, which of the following tree can be used  

Explanation

A binary tree can be used to sort n numbers in ascending order in O(nlogn) time. In a binary tree, each node has at most two children, a left child and a right child. By performing an in-order traversal of the binary tree, the numbers can be visited in ascending order. However, it is important to note that a binary tree does not guarantee efficient searching or insertion operations, so it may not be the most optimal choice for sorting large sets of numbers.

Submit
15. A binary search tree is generated by inserting in order the following integers: 50, 15, 62, 5, 20, 58, 91, 3, 8, 37, 60, 24 The number of the node in the left sub-tree and right sub-tree of the root, respectively, is

Explanation

not-available-via-ai

Submit
View My Results

Quiz Review Timeline (Updated): Mar 22, 2023 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 22, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Aug 31, 2018
    Quiz Created by
    ADS11
Cancel
  • All
    All (15)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
If we first delete a key from an R-B tree and add it back then, how...
If we first delete a key from 2-3 tree and then add it back then, how...
The following are the case of ...................in red black Tree
A 2-3 is a tree such that ...
Which type of traversal of binary search tree outputs the value in...
The tree is an example of 
Suppose a binary tree is constructed with n nodes, such that each node...
The height of a BST is given as h. Consider the height of the tree as...
The rotation need to be done is
For a 2 -3 Tree which of the following is true
The run time for traversing all the nodes of a binary search tree with...
Suppose we have numbers between 1 and 1000 in a binary search tree and...
Which of the following trees have height as O(lgn) where number of...
If n numbers are to be sorted in ascending order in O(nlogn) time,...
A binary search tree is generated by inserting in order the following...
Alert!

Advertisement