What is the worst-case time complexity for inserting a node into a Red-Black Tree?
O(1)
O(n log n)
O(n)
O(log n)
What is the worst-case time complexity for searching for a specific value in a perfectly balanced BST?
When deleting a node with two children in a BST, what is the standard approach to maintain the BST property?
Replace the node's value with the smallest value from its right subtree and recursively delete the node with the smallest value.
Replace the node's value with the largest value from its left subtree and recursively delete the node with the largest value.
Any of the above options can be used.
Remove the node and connect its children directly to its parent.
Consider a Segment Tree designed to handle range sum queries. An update operation is performed on a single element of the original array. How many nodes in the Segment Tree, on average, need to be updated to reflect this change?
O(√n)
Is it possible for a Complete Binary Tree to have two adjacent levels that are both not completely filled?
Yes, as long as the unfilled nodes are on the rightmost side of both levels.
No, it violates the definition of a Complete Binary Tree.
Yes, as long as the tree is left-skewed.
Yes, but only if the tree is right-skewed.
You want to print the nodes of a binary tree in a way that nodes at the same level are printed together, from left to right. Which traversal method achieves this?
Inorder Traversal
Preorder Traversal
Level Order Traversal
Postorder Traversal
In Huffman coding, what is the primary factor that determines the length of the codeword assigned to a character?
Lexicographical order of the character
Position of the character in the input text
ASCII value of the character
Frequency of occurrence of the character
In an AVL Tree, what is the maximum allowed height difference between the left and right subtrees of any node?
2
3
0
1
Which of these operations is NOT efficiently supported by a standard Fenwick tree?
Updating a range of elements with a given value
Updating a single element in the array
Calculating the sum of elements in a given range
Finding the minimum value in a given range
Which type of tree rotation is performed when a node's balance factor becomes 2 and its right child's balance factor is -1?
Right-Left Rotation
Left Rotation
Right Rotation
Left-Right Rotation