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) Mergesort makes two recursive calls.

ID: 3581216 • Letter: P

Question

PLEASE ANSWER THE 3 QUESTIONS CORRECTLY

1) Mergesort makes two recursive calls. Which statement is true after these recursive calls finish, but before the merge step?

      
A) Elements in the first half of the array are less than or equal to elements in the second half of the array.

      
B) The array elements form a tree.

      
C) Elements in each half of the array are sorted among themselves.


2) Consider the following function. The line numbers are indicated on the left side for reference only and are not part of the code.

1 float p( float x, int n )
2 {
3 if ( n == 0 )
4 return 1;
5 else
6 return x * p( x, n – 1 );
7 }

The base case is shown on:


      
A) line 1

      
B) lines 3-4

      
C) lines 5-6

      
D) lines 3-6

3) What is the best definition of a collision in a hash table?

      
A) Two entries with different keys have the same exact hash value.

      
B) Two entries are identical except for their keys.

      
C) Two entries with different data have the exact same key.

      
D) Two entries with the exact same key have different hash values.

Explanation / Answer

The answers are as follows :

1. In merge sort, the two sorted arrays are merged in the merge() step.

C) Elements in each half of the array are sorted among themselves.

2. The base case means where the recursion will terminate to a known value. So the correct answer is:

B) lines 3-4

3. When two times calculation of hashing function refers to same address location, it is collision in hashing.

So, the answer is:

A) Two entries with different keys have the same exact hash value.

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