In the bubble sort algorithm, which code accomplishes swapping values in elements at positions index and index + 1?
A. list[index] = list[index + 1]
list[index + 1] = list[index]
B. list[index + 1] = list[index]
list[index] = list[index + 1]
C. list[index] = temp;
list[index] = list[index + 1];
temp = list[index + 1];
D. temp = list[index];
list[index] = list[index + 1];
list[index + 1] = temp;
Answer: D
Computer Science & Information Technology
You might also like to view...
The SSF used within BSIMM consists of four domains. Which of the following is not one of the four domains?
A. Governance B. Intelligence C. SSDL Touchpoints D. Development
Computer Science & Information Technology
Which of the following are Boolean operators?
a. AND b. OR c. NOT d. All of these
Computer Science & Information Technology