Which sorting algorithm could have this shape for number of comparisons for n=5:

a)
****    Selection Sort
 ***
  **
   *

b)
****    Bubble Sort

c)
 *      Insertion Sort
 **
   *
  ***


What is the value of each expression: 27 % 5 = 2 10 % 12 = 10 12 % 10 = 2 375 % 375 = 0
What is the value of n after each line is executed: int n = 5; // n = 5 n *= 3; // n = 15 n--; // n = 14 --n; // n = 13 n -= 2; // n = 11 n /= 4; // n = 2
Consider the following mystery method:
int mystery( int u, int v ) { int c = 0; for ( int d = u ; d <= v; d = d + 1 ) { int e = 0; for ( int f = d ; f <= v; f = f + 1 ) { e = e + f; } c = c + e; } return c; }
What is computed/returned and stored in answer after executing:
int answer = mystery( 1, 2 ); // answer = 5

Consider the following mystery method:
void mystery( int[] u, int v ) { while ( v < u.length - 2 ) { u[v+1] = u[v-1]; ++v; if ( u[v] > u[0] ) { ++u[v+1]; } else { u[v] -= u[v+1]; } } printArray( u ); }
What is printed after executing:
int[] numbers = { 1, 2, 3, 4, 5, 6 }; mystery( numbers, 1 ); // numbers = { 1, 2, -3, 2, -9, 6 }