Question
Java
We did in lecture, and explain your answer briefly. Problem 4: Sorting practice 14 points; 2 points for each part individual-
0 0
Add a comment Improve this question Transcribed image text
Answer #1

1)

Array after 1st iteration: 7, 14, 27, 13, 24, 20, 10, 33

Array after 2nd iteration: 7, 10, 27, 13, 24, 20, 14, 33

Array after 3rd iteration: 7, 14, 13, 27, 24, 20, 10, 33

2)

Array after 1st iteration: 7, 14, 27, 13, 24, 20, 10, 33

Array after 2nd iteration: 7, 10, 14, 27, 13, 24, 20, 33

Array after 3rd iteration: 7, 10, 13, 14, 27, 24, 20, 33

3)

Array after 1st iteration: 7, 14, 27, 13, 24, 20, 10, 33

Array after 2nd iteration: 7, 10, 14, 27, 13, 24, 20, 33

Array after 3rd iteration: 7, 10, 13, 14, 27, 24, 20, 33

Array after 4th iteration: 7, 10, 13, 14, 27, 24, 20, 33

Array after 5th iteration: 7, 10, 13, 14, 20, 27, 24, 33

4)

Array after 1st pass: 7, 14, 13, 24, 20, 10, 27, 33

Array after 2nd pass: 7, 13, 14, 20, 10, 24, 27, 33

Array after 3rd pass: 7, 13, 14, 10, 20, 24, 27, 33

Add a comment
Know the answer?
Add Answer to:
Java We did in lecture, and explain your answer briefly. Problem 4: Sorting practice 14 points;...
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
  • 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...

  • Problem 4: Sorting and Searching (55 points) a) (20 points) Scarch for the character K using...

    Problem 4: Sorting and Searching (55 points) a) (20 points) Scarch for the character K using the binary search algorithm on the following array of characters: KM 2. R For each iteration of binary search use the table below to list: (a) the left index and (b) the right index of the array that denote the region of the array that is still being searched, (c) the middle point index of the array, and (d) the number of character-to-character comparisons...

  • For java review please help #2 2. (15 points (-14+1)) Compare the execution complexity of sorting...

    For java review please help #2 2. (15 points (-14+1)) Compare the execution complexity of sorting algorithms. Worst Case Average Case Selection Sort (2.1) Bubble Sort (2.2) Insertion Sort (2.3) Radix Sort Merge Sort Quicksort Heap Sort (2.8) (2.9) (2.10) (2.4) (2.5) (2.6) (2.7) (2.12) (2.13) (2.14) 3. (10 points) Answer the following questions for an array based representation of a complete binary tree (say the array name is binTree). (3.1) root of tree bin Tree LoT

  • Sorting: (40 points) a. We studied several sorting algorithms. Every sorting algorithm has their own special...

    Sorting: (40 points) a. We studied several sorting algorithms. Every sorting algorithm has their own special reason where it can only use. Can you explain carefully in which situation the following algorithms would be best sorting algorithm to use in an application. (10 points) i. Insertion sort ii. Selection sort iii. Merge sort iv. Quick sort b. You are given a string of elements as below, Canopus, Mimosa, Betelgeuse, Deneb, Stars, Pollux, Antares, Sirius, Hader i. Your task is to...

  • Need help with program. I'm stuck Objectives: In this assignment, we will practice manipulating lists of...

    Need help with program. I'm stuck Objectives: In this assignment, we will practice manipulating lists of data and arranging items in an ascending/descending order. you will also explore storing lists/arrays using different sorting algorithms including, the selection sort, bubble sort, and insertion sort algorithm. Comparison between the three algorithms are made based on the number of comparisons and item assignments (basic operations) each algorithms executes. Background: Ordering the elements of a list is a problem that occurs in many computer...

  • Bubble sort is a popular, but inefficient, sorting algorithm. It works by repeatedly swapping adjacent elements...

    Bubble sort is a popular, but inefficient, sorting algorithm. It works by repeatedly swapping adjacent elements that out of order. BUBBLESORT(A) 1. for i = 1 to A.length – 1 2. for j = i + 1 to A.length 3. if A[j] < A[i] 4. exchange A[j] with A[i] a) A loop invariant for the outer for loop in lines 1 – 4 is: At iteration i, the sub-array A[1..i] is sorted and any element in A[i+1..A.size] is greater or...

  • Comparison of Sorting Algorithms You are required to implement all the sorting algorithms (Bubble, Selection, Insertion...

    Comparison of Sorting Algorithms You are required to implement all the sorting algorithms (Bubble, Selection, Insertion, Quick, Merge). Take help from lecture slides and welb . You will then create arrays of different sizes as instructed below, test each algorithm on each array and record the execution times of each individual algorithm on each array. . You will report these execution times in a table and then write a report explaining the execution times of the sorting algorithms according to...

  • a. We studied several sorting algorithms. Every sorting algorithm has their own special reason where it...

    a. We studied several sorting algorithms. Every sorting algorithm has their own special reason where it can only use. Can you explain carefully in which situation the following algorithms would be best sorting algorithm to use in an application. (10 points) i. Insertion sort ii. Selection sort iii. Merge sort iv. Quick sort b. You are given a string of elements as below, Canopus, Mimosa, Betelgeuse, Deneb, Stars, Pollux, Antares, Sirius, Hader i. Your task is to insert the above...

  • Programming language: Java Home Work No.2 due 09.11.2019 either ascending or descending SORTING: An array is...

    Programming language: Java Home Work No.2 due 09.11.2019 either ascending or descending SORTING: An array is said to be ordered if its values order. In an ascending ordered array, the value of each element is less than or equal to the value of the next element. That is, [each element] <= [next element]. A sort is an algorithm for ordering an array. Of the many different techniques for sorting an array we discuss the bubble sort It requires the swapping...

  • Student Name Student ID CS209 Data Structures and Algorithms - Quiz 1/2e Friday, Feb 22, 2019...

    Student Name Student ID CS209 Data Structures and Algorithms - Quiz 1/2e Friday, Feb 22, 2019 1. (25 points) Here is an array of five integers: 5,3,4,2,1 Please draw this array after EACH iteration of the large loop (outer loop) in a Bubble sort (sorting smallest to largest). (25 points) Here is an array of five integers: 5,3,4,2,1 Please draw this array after EACH iteration of the large loop (outer loop) in a Selection sort (sortin from smallest to largest)....

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
ADVERTISEMENT