Computers and Technology
Computers and Technology, 09.01.2021 17:20, BluSeaa

Consider the following sort method. This method correctly sorts the elements of array arr into increasing order.

public static void sort(int[] data)
{
for (int j = arr. length 2; j >= 0; j--)
{
int move = arr[j];
int k = j + 1;
while (k < arr. length && move > arr[k])
{
arr[k - 1] = arr[k]; /* Shuffle elements upwards */
k++;
}
arr[k - 1] = move; /* Insert value into position */
/* end of for loop */
3
}

Assume that sort is called with the array(4,1,0,3,5,2). What will the value of arr be
after two passes of the for loop (i. e. when j = 3 at the point indicated by /* end of for loop
7)?

A. 0,1,2,3,4,5
B. 4,0,1,2,3,5
C. 4,1,0,3,5,2
D. 4,1,0,3,2,5
E. 4,1,0,2,3,5

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 04:30, fatherbamboo
Dr. wisteria is a prominent chiropractor in the chicago area. she wants to provide a forum for her patients to discuss their health concerns and to seek and offer advice to other patients. which telecommunications tool is most appropriate for dr. wisteria's needs?
Answers: 3
image
Computers and Technology, 22.06.2019 08:10, josued123321
Alook-up table used to convert pixel values to output values on a monitor. essentially, all pixels with a value of 190 or above are shown as white (i. e. 255), and all values with a value of 63 or less are shown as black (i. e. 0). in between the pixels are scaled so that a pixel with a value p is converted to a pixel of value 2/127 −+3969). if a pixel has a value of 170 originally, what value will be used to display the pixel on the monitor? if a value of 110 is used to display the pixel on the monitor, what was the original value of the pixel?
Answers: 1
image
Computers and Technology, 23.06.2019 01:50, akornegay2
Write a program that uses a random number generator to generate a two digit positive integer and allows the user to perform one or more of the following operations: a. double the number. b. reverse the digits of the number. c. raise the number to the power of 2, 3, or 4. d. sum the digits of the number. e. if the number is a two-digit number, then raise the first digit to the power of the second digit. f. if the number is a three-digit number and the last digit is less than or equal to 4, then raise the first two digits to the power of the last digit. after performing an operation if the number is less than 10, add 10 to the number. also, after each operation determine if the number is prime. each successive operation should be performed on the number generated by the last operation. your program should not contain any global variables and each of these operations must be implemented by a separate function. also, your program should be menu driven. 7. (fraction calculator) write a program that
Answers: 1
image
Computers and Technology, 23.06.2019 07:00, MissSmartyPants88
To produce a starlight effect in her photograph, lina should choose the filter for her camera.
Answers: 1
Do you know the correct answer?
Consider the following sort method. This method correctly sorts the elements of array arr into inc...

Questions in other subjects:

Konu
Mathematics, 17.08.2021 07:10
Konu
Social Studies, 17.08.2021 07:10
Konu
Mathematics, 17.08.2021 07:10
Konu
Social Studies, 17.08.2021 07:10