(A) Log (h)
(B) 2^(h+1)- 1
(C) Log (h) – 1
(D) 2^h – 1
Tag: Data Structures
If you know the size of the data structure in advance, i.e., at compile time, which one of the following is a good data structure to use?
(A) Array
(B) List
(C) Both of the above
(D) None of the above
Void f(int i, int &k) {i = 1;k = 2; } Suppose that a main program has two integer variables x and y, which are given the value 0. Then the main program calls f(x,y); What are the values of x and y?
(A) Both x and y are still 0
(B) x is now 1, but y is still 0
(C) x is still 0, but y is now 2
(D) x is now 1, and y is now 2
A kind of expressions where the operator is present between two operands called __ expressions.
(A) Infix
(B) Postfix
(C) Prefix
(D) None of the above
“+” is a __ operator.
(A) Binary
(B) Unary
(C) Ternary
(D) None of the above
Suppose A is an array containing numbers in increasing order, but some numbers occur more than once when using a binary search for a value, the binary search always finds?
(A) The first occurrence of a value
(B) The second occurrence of a value
(C) May find first or second occurrence of a value
(D) None of the given options
Which of the given option is NOT a factor in Union by Size?
(A) Maintain sizes (number of nodes) of all trees, and during union
(B) Make smaller tree, the subtree of the larger one
(C) Make the larger tree, the subtree of the smaller one
(D) Implementation: for each root node i, instead of setting parent[i] to -1, set it to -k if tree rooted at i has k nodes
A complete binary tree of height __ has nodes between 16 to 31.
(A) 2
(B) 3
(C) 4
(D) 5