Programming Problems +--------------------------------------+ The purpose of thi
ID: 3672700 • Letter: P
Question
Programming Problems +--------------------------------------+ The purpose of this lab assignment is to help you solve part of Project I; in this case, sorting a set of integer numbers. Your task is the following: 1. Using the Java code "Sorting.java" provided along with this assignment, implement the two sorting algorithm methods--namely Bubble and Insertion Sorting. 2. The two methods in "Sorting.java" are left blank, so that you can implement them with your own code. Pseudocode for the logic of Bubble Sort +--------------------------------------+ For lastPosition = last subscript in the array, decremented down to 0 For index =0 up through lastPosition -1 If array[index] > array[index+1] Swap array[index] with array[index+1] End If End For End For Pseudocode for the logic of Insertion Sort +-----------------------------------------+ For index equals each subscript in array from 1 through the last subscript Save the value in index in scan Save the value in array[index] in unsortedValue While scan is greater than 0 and array[scan-1] is greater than unsortedValue Move array[scan -1] to array[scan] Subtract 1 from scan End While Store the value in unsortedValue in array[scan] End For
Explanation / Answer
1)
2)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.