Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote