Question

Java

1. (5) Assume selection sort is applied to the following array. Show the state of the array after the first pass of the outer loop. 50 35 15 100 90 20 10 25 2. (5) Assume bubble sort is applied to the following array. Show the state of the array after the first pass of the outer loop 50 35 15 100 90 20 10 25 3. (5) Assume quicksort is applied to the following array. Show the state of the array after quicksort has partitioned the array. Use the element in position 0 as the pivot value. 50 35 15 100 90 20 10 25 4. (5) Assume radix sort is applied to the following array. Show the state of the array after the first pass of the outer loop

0 0
Add a comment Improve this question Transcribed image text
Answer #1

, selection so㎡rg es an algoo7thm on when ate cop frnt valueto the Seeond talue and ke frit value and third alyer compase val

Giten Away Ra 50 36 5 1o0 9o 20 88 0 25 5S 56735 upap CYe) 35 50 15 100 до 2088 Ib 2S55、 3671S 1S 5o 5 (00 9 20 88 25 5 1bo Nup

lo 50 35 o0 90 20 88 25 55 0 5 50 35 l00 90 20 88 IS 2s 5S 10 50 35 100 go 208815 오555 lo>S5 No o 50 3 0 90 88 15 25 5S Stake

Given Aray 50 35 15 10o 9o 20 38 to 25 55 Pass 5o 35 15 too 9o 20 8 0 25 55 50>35 → suap CYES) 35 5 15 100 90 0 83 o 5 55 50>

35 15 50 до 20 88 (00 10 25 55 3 5 50 90 20 88 10 10025 S5 CYES) 35 15 50 9 20 8 lo 25 100 55 CYEs) 25 15 50 90 20 88 10 25 5

Each re와ation of Kroon a the PNot and divides the l s+ īnto2 roLpS the quiceso sele crs an element rDepshePVo . Elemenh5 uo h

euant to TOOe al of the elemen ks smalley than the Pivo to the left pait o the and all oF the etement lauger than the o move

then tebt and stght have Sto ppedlebt s n an element greae than (or eual to) the piVat and sight onan elament imae than (ou e

50 5 1S 5 to 0 88 90 6o S5 Pvot hight Again xepent tme Ap 15 25 lo 20 g89D to o 55 ight eb Nouo eht and ight have Hosed each

2 0 05o50 3 90 100 aax ethe tinea. sorting al geri thna on each dfait for eachop the digit in the umbe Hooeveu is Someuohat e

Given Aroay 5o 2 5 16 Pa8s 82 2.5 55, gA 2 3 4 5 50 g 32 2. 2S 20

Add a comment
Know the answer?
Add Answer to:
Java 1. (5) Assume selection sort is applied to the following array. Show the state of...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 1.Show the state of the following array after the outer loop of the bubble sort algorithm...

    1.Show the state of the following array after the outer loop of the bubble sort algorithm has executed one time. [0] [1] [2] [3] [4] [5] 19 23 2 4 99 1 2. Show the state of the following array after the outer loop of the selection sort algorithm has executed two times. [0] [1] [2] [3] [4] [5] 12 1 9 23 17 11 3. Show the state of the following array after the outer loop of the insertion...

  • 5. Radix Sort Sort the following array using a radix sort with base 10, showing each...

    5. Radix Sort Sort the following array using a radix sort with base 10, showing each pass a. .791316.64|.39|.20|.89.53|.71.42 5. Radix Sort Sort the following array using a radix sort with base 10, showing each pass a. .791316.64|.39|.20|.89.53|.71.42

  • 5. Radix Sort Sort the following array using a radix sort with base 10, showing each...

    5. Radix Sort Sort the following array using a radix sort with base 10, showing each pass a. .791316.64|.39|.20|.89.53|.71.42

  • Show the execution of the selection sort algorithm on the following array. Hint: The yellow or...

    Show the execution of the selection sort algorithm on the following array. Hint: The yellow or shaded squares should be the remaining unsorted values. Pass # 0 1 2 3 4 5 6 7 0 16 11 21 32 41 20 3 9 1 2 3 4 5 6 7 Show the execution of the insertion sort algorithm on the following array. Hint: The yellow or shaded squares should be the remaining unsorted values. Pass # 0 1 2 3...

  • 1. Which of the following algorithms requires the most extra space when implemented? A. Quicksort B....

    1. Which of the following algorithms requires the most extra space when implemented? A. Quicksort B. Mergesort C. Radix sort D. All use the same amount of extra space 2. Sort this array into ascending order: 80 90 70 85 60 40 50 95. Assume the pivot is 40. (SHOW WORK) A. (40) and (50 60 70 80 85 90 95) B. () and (80 90 70 85 60 50 95) C. () and (50 60 70 80 85 90...

  • Sorting Sort the following array using the quick sort algorithm: (4 Marks) a. 12 26 8...

    Sorting Sort the following array using the quick sort algorithm: (4 Marks) a. 12 26 8 9 7 0 4 Pivot selection is defined to be the first element of each sub-list. Show the array before and after each quicksort round (when the array is partitioned after placing the pivot at its correct position). Also, clearly highlight the pivot in each partition b. Consider an unsorted array of integers of size n. Write a Java program to arrange the array...

  • Write a program in Java that obtains the execution time of selection sort, insertion sort, bubble...

    Write a program in Java that obtains the execution time of selection sort, insertion sort, bubble sort, merge sort, quick sort, and radix sort. Your program should test all sort methods for input sizes of 10000, 20000, 30000, 40000, 50000, and 60000. The selection sort, bubble sort, and radix sort should also be tested for input sizes 100000 and 200000. Your program should create the data that is sorted from randomly generated integers and should output the results in a...

  • . Shell sort is a sorting algorithm similar to insertion sort. Research shell sort and apply...

    . Shell sort is a sorting algorithm similar to insertion sort. Research shell sort and apply that to the following array. Show your work in Detail. [15 points] 45 20 50 10 80 30 60 70 40 90 2. Is Shell sort a stable sorting algorithm? Answer this with an example. [10 points] 3. Apply Merge Sort to sort the following list. Show your work in Detail. [15 Points] 45 20 50 10 80 30 60 70 40 90 4....

  • Sort the following list using the bubble sort algorithm as discussed in this chapter. Show the...

    Sort the following list using the bubble sort algorithm as discussed in this chapter. Show the list after each iteration of the outer for loop. 46, 58, 16, 25, 83, 98, 8, 70, 5, 62

  • JAVA Each of the following 6 questions refer to the following list of values in the...

    JAVA Each of the following 6 questions refer to the following list of values in the order as shown. 555 288 633 666 444 422 399 477 21. Print the values in the order they would have after the first round of bubble sort’s bubbling operation low to high. 22. Print the values in the order they would have after the first round of selection sort for sorting low to high, assuming it selects the max. 23. Print the values...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT