Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Section 1 : 1 . Add your section comment to the code. 2 . Print * * * * * * * * * *
Section :
Add your section comment to the code.
Print Section Bubble Sort
Print a blank line.
Create an array called studentGrades and populate the array with the following grades: and
Create a method called sortArrayDescBS which implements a bubble sort algorithm that will sort the grade array from highest to lowest.
Create a method called sortArrayAscBS which implements a bubble sort algorithm that will sort the grade array from lowest to highest.
Create a method called printArray which will print the contents of an integer array passed to it
On a new line, print The unsorted list of grades is followed by the contents of the unsorted array using the printArray method.
Print a blank line.
Call the sortArrayDescBS method.
On a new line, print The grades in descending order are, followed by the newly sorted array using the printArray method.
Call the sortArrayAscBS method.
On a new line, print The grades in ascending order are, followed by the newly sorted array using the printArray method.
Section :
Add your section comment to the code.
Print a blank line.
On a new line, print Section: Quick Sort to the console.
Print a blank line.
Create a method called sortArrayDescQS which implements a quick sort algorithm, using recursion, that will sort the grade array from highest to lowest.
Create a method called sortArrayAscQS which implements a quick sort algorithm, using recursion, that will sort the grade array from lowest to highest.
For the following steps, use the original unsorted grades array from Section
On a new line, print The unsorted list of grades is followed by the contents of the unsorted array using the printArray method.
Print a blank line.
Call the sortArrayDescQS method.
On a new line, print The grades in descending order are, followed by the newly sorted array using the printArray method.
Call the sortArrayAscQS method.
On a new line, print The grades in ascending order are, followed by the newly sorted array using the printArray method.
Section :
Add your section comment to the code.
Print a blank line.
On a new line, print Section: Sequential Search to the console.
Print a blank line.
Write a method named seqSearch which accepts an integer array and a value to find in the array. Have the seqSearch method return a string message stating the index in the array where the value sought was located or a message stating the value was not located in the array.
Call the seqSearch method passing it a copy of the grades array sorted in ascending order and the value
On a new line, print The contents of the grade array are, followed by the sorted grade array used.
Print a blank line.
On a new line, print the message returned from the search method.
Call the seqSearch method a second time, passing it the same copy of the sorted grades array along with the value
Print a blank line.
On a new line, print the message returned from the search method.
Section :
Add your section comment to the code.
Print a blank line.
On a new line, print Section: Binary Search to the console.
Print a blank line.
Write a method named binarySearch which accepts an integer array and a value to find in the array. Have the binarySearch method return a string message stating the index in the array where the value sought was located or a message stating the value was not located in the array.
Call the binarySearch method passing it the same copy of the sorted grades array from Section and the value
On a new line, print The contents of the grade array are, followed by the sorted grade array used.
Print a blank line.
On a new line, print the message returned from the search method.
Call the seqSearch method a second time, passing it the same copy of the sorted grades array along with the value
Print a blank line.
On a new line, print the message returned from the search method.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started