PLEASE ANSWER THE 3 QUESTIONS CORRECTLY 1) When is insertion sort a good choice
ID: 3581213 • Letter: P
Question
PLEASE ANSWER THE 3 QUESTIONS CORRECTLY
1) When is insertion sort a good choice for sorting an array?
A) The processor speed is fast.
B) Each component of the array requires a large amount of memory.
C) Each component of the array requires a small amount of memory.
D) The array has only a few items out of place.
2) Here is a small binary tree:
What is the order of nodes visited using a pre-order traversal?
A) 1 2 3 7 10 11 14 30 40
B) 1 2 3 14 7 10 11 40 30
C) 14 2 1 3 11 10 7 30 40
D) 1 3 2 7 10 40 30 11 14
3) Consider the following recursive function:
void quiz(int i)
{
if (i > 1)
{
quiz(i / 2);
quiz(i / 2);
}
cout << "*";
}
How many asterisks will print with this call:
quiz(0);
A) 0
B) 1
Explanation / Answer
1) When is insertion sort a good choice for sorting an array?
Answer: D) The array has only a few items out of place.
2) Here is a small binary tree What is the order of nodes visited using a pre-order traversal?
Answer: B) 1 2 3 14 7 10 11 40 30
3) Consider the following recursive function:
void quiz(int i)
{
if (i > 1)
{
quiz(i / 2);
quiz(i / 2);
}
cout << "*";
}
3)How many asterisks will print with this call:
quiz(0);
Answer: B) 1
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.