Question
I need the answer
selection 3. Given the array of 10 integers shown below, apply bubble sort to sort the array of values into descending order
0 0
Add a comment Improve this question Transcribed image text
Answer #1

1 max index = 6 15 | s4 | 3 | 4 | 20 vet | 50 | 50 | 10 15 movie 1 90 134) 1216/24/18 | 45121 119 155 After 1st the pass of sselection Sort (cut arr3 , int n) void int i, j, mas; for(i=0; i<n-1; i++) max = i; for(j=i+1, j<n; j++). if Carr C;]> arr [macil ) avr [j] > arr (max) a [max ] 45 No No 12 No 45 45 20. Wagwo 8 45 NO 45 Yes go No 90 No 90 | 55 | N. selection pass 90

Add a comment
Know the answer?
Add Answer to:
I need the answer selection 3. Given the array of 10 integers shown below, apply bubble...
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
  • Write a JAVA Program: Compare the performance of bubble sort and selection sort over several arrays....

    Write a JAVA Program: Compare the performance of bubble sort and selection sort over several arrays. - Write two methods that sort arrays of doubles. One method should use selection sort, and the other should use bubble sort. - In each of the sort methods, add code that counts the total number of comparisons and total number of swaps performed while sorting the entire array (be careful; don't count each pass through the array separately) - Each time an array...

  • TO DO: IMPLEMENT SELECTION SORT, BUBBLE SORT, MERGE SORT INSTRUCTIONS: GENERATE AN ARRAY arr AND FILL...

    TO DO: IMPLEMENT SELECTION SORT, BUBBLE SORT, MERGE SORT INSTRUCTIONS: GENERATE AN ARRAY arr AND FILL IT WITH 100 RANDOM INTEGERS, HAVING VALUES 0-99. PRINT THE UNSORTED ARRAY IMPLEMENT EACH SORTING ALGORITHM (DO NOT USE THE BUILT-IN LIBRARIES) FOR EACH ALGORITHM, INCLUDE PSEUDOCODE WITH NUMBERED STEPS. IN YOUR CODE, CLEARLY COMMENT WHICH STEP IS BEING PERFORMED BY THE LINE OR BLOCK OF CODE. USE A TIMER TO CHECK HOW LONG EACH ALGORITHM TAKES TO SORT THE ARRAY. THIS SHOULD BE...

  • You are given an input array of integers: [8, 3, 7, 1, 2, 10, 5]. (a)...

    You are given an input array of integers: [8, 3, 7, 1, 2, 10, 5]. (a) Build a min-heap for the input data. Draw a figure just to show the min-heap. (b) Using the min-heap built above, sort the input data in non-descending order using the heap sort algorithm.

  • Java We did in lecture, and explain your answer briefly. Problem 4: Sorting practice 14 points;...

    Java We did in lecture, and explain your answer briefly. Problem 4: Sorting practice 14 points; 2 points for each part individual-only Important: When answering these questions, make sure to apply the versions of these algorithms that were discussed in lecture. The Java code for each algorithm can be found in our Sort class. Given the following array: {14, 7, 27, 13, 24, 20, 10, 33 1. If the array were sorted using selection sort, what would the array look...

  • 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...

  • Below I have done a bubble sort on an array. I need to figure out how...

    Below I have done a bubble sort on an array. I need to figure out how to change the --- bubbleSort() method... with a new method called oddEvenSort() method.. I know I have to do two passes one for odd, one for even, can I have someone help me do this please I keep getting a lot of errors when I attempt to do it. Java code to change is below. I have to sort the array using one pass...

  • You will create a dimple Bubble Sort program to sort a string of random integers or...

    You will create a dimple Bubble Sort program to sort a string of random integers or text. Please read instructions and examples Please show screenshot of proof that the code works in the C program ECE 216 Programming Project 2 The Bubble Sort You will create a simple Bubble Sort program to sort a string of random integers or text or whatever you can punch in from the keyboard. For the input data, you will input a string of single...

  • complete the following in c++ programming code and answer question 3. use question 2 below as...

    complete the following in c++ programming code and answer question 3. use question 2 below as reference 2. If your nameArray variable is sorted using Bubble Sort Algorithm, it will go through a several pass-throughs and characters will be swapped in each pass-through, until nameArray gets completed sorted (alphabetically ascending order). Show all these stages (Passes and iterations within Passes) for your nameArray. Based on our example, here is a sample of how I want you to write these steps:...

  • C++ Sorting and Searching 1. Mark the following statements as true or false. a. A sequential...

    C++ Sorting and Searching 1. Mark the following statements as true or false. a. A sequential search of a list assumes that the list elements are sorted in ascending order. b. A binary search of a list assumes that the list is sorted. 2. Consider the following list: 63 45 32 98 46 57 28 100 Using a sequential search, how many comparisons are required to determine whether the following items are in the list or not? (Recall that comparisons...

  • Question 3 Given the input list [72, 29, 18, 4, 5, 64, 37, 2, 13, 10,...

    Question 3 Given the input list [72, 29, 18, 4, 5, 64, 37, 2, 13, 10, 23, 51, 95] Show every step of how the Selection Sort algorithm would proceed to sort this list in ascending order. Your solution goes here • You may wish to change the format of this Markdown cells into a Raw cell instead Question 4 Given the input list [72, 29, 18, 4, 5, 64, 37, 2, 13, 10, 23, 51, 95] • Show every...

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