Highlights
Question 1
You are to write a Display method, which will display the contents of this array to the screen. Add the appropriate code to Main, so the numbers are displayed. The particular challenge for this question is to then add a fine maximum method to your program that will receive two parameters:
This method has the job of displaying the n largest elements in the array it receives and displaying it to the screen as shown in the sample program below.
Question 2
When using a sequential search algorithm (such as linear) to find a value, it will always find the first occurrence of that item in the array. For example consider an array intArray with values 2, 4, 8, 6, 18, 4, 9, 4, 3. If the user wanted to search for the number 4 in the array, a sequential search algorithm will return
the first occurrence of 4 (that is at index 1 in the intArray). For this question, you are required to extend the program and class created in question 1 by adding
a NumOccuranceSearch method, which is a modified sequential search that receives three parameters:
an array
an integer (the value the user wants to search for i.e. 4)
and a second integer (the occurrence of the item they want to search for i.e. 2 nd ).
The method is to display the index of the occurrence of that number to the screen as shown in the sample program below.
Question 3
For this question, you are required to extend the program and class even further by adding a LastOccuranceSearch method, which finds the last occurrence of the searched item. The method should receive two parameters:
an array
an integer (the value the user wants to search for i.e. 4)
And return the index of the last occurrence to Main, so it can be displayed.
Question 4
As you know the bubble sort algorithm isn’t the fastest method for sorting data, but it could be improved. The challenge for this question is to look at improving the bubble sort. Consider the following: You will notice after the first pass of the algorithm the highest number is “in place”, after the second pass the two highest numbers are “in place” and so on. Consider as the array elements are moved so the highest numbers in place, do we need to continue to make 49 passes of a 50 element array? Or can this be reduced? For this question, you are required to extend your program and class again by adding the following two methods:
bubble sort ()
improved bubble sort ()
The bubble sort () method will implement the standard bubble sort algorithm and time how long the takes to sort the values in your array.
The improved bubble sort () method will implement the following two improvements and time how long it takes to sort the same data:
1. Modify the algorithm so instead of making 49 comparisons on every pass of a 50 element array, it will now make 48 comparisons on the second pass, 47 on the third pass and so on.
2. Also, modify the algorithm to check at the end of each pass whether any swaps have been made. If none have been made, the data must already be in the proper order, so the algorithm should terminate. Both methods should output the resulting times to the screen to see if any improvement in times has been achieved.
This COMP.6211: Computer Science Assignment has been solved by our Computer Science experts at My Uni Paper. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our experts are well trained to follow all marking rubrics & referencing style.
Be it a used or new solution, the quality of the work submitted by our assignment experts remains unhampered. You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turnitin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction.
© Copyright 2026 My Uni Papers – Student Hustle Made Hassle Free. All rights reserved.