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

Which statement is not true about bubble sort applied to an array of 1000 number

ID: 3828345 • Letter: W

Question

Which statement is not true about bubble sort applied to an array of 1000 numbers? a. On each pass of the outer loop one item is placed into its final position. b. The number of swaps made in the inner loop varies with different data sets. c. The bubble sort algorithm is considered to be a slow algorithm, partly due to the nested loop structure. d. The number of passes of the outer loop varies with the data pattern as the algorithm stops once the array becomes sorted. The next two questions use the list box named 1stNames seen on the form below. An array ages contains the ages of each of the four people shown in list box 1stNames. Will the following code display the correct age when the user clicks on a person's name? Dim index As Integer = 1stNames.SelectedIndex = ages(index) a. True (Yes) b. False (No) Which code segment correctly loops through the array ages adding 1 to each age? Dim i As Integer Dim ages (3) As Integer a. For i = 0 To 3 ages(i) = ages(i) + 1 Next b. For i = 1 To 4 ages(i) = ages(i) + 1 Next c. For index = 0 To 3 ages(0) = ages(0) + 1 Next Trace bubble sort on the following array on first three passes of the outer loop and show the contents of the array after the first pass of the outer loop. Use code presented in lecture. Write final answer only in the cell, do intermediate calculations on scrap paper.

Explanation / Answer

6.

d. The number of passes of the outer loop varies with the data pattern as the algorithm stops once the array becomes sorted.

7. a) True.

First the index is extracted by using selectedIndex into index and then index is used to display the ages at that index into the textbox.

8.

a. for i = o To 3

ages(i) = ages(i) +1

Next

Arrays are generally 0 based in VB

9.

45 100 12 76 81 12 5 32 45 12 76 81 12 5 32 100 12 45 76 12 5 32 81 100 12 45 12 5 32 76 81 100