Question: java code 3.2 Add a method called median() to the ArrayIns class in the insertSort.java program (Listing 3.3). This method should return the median value

3.2 Add a method called median() to the ArrayIns class in the insertSort.java program (Listing 3.3). This method should return the median value in the array. (Recall that in a group of numbers half are larger than the median and half are smaller.) 3.3 To the insertSort.java program (Listing 3.3), add a method called noDups() that removes duplicates from a previously sorted array without disrupting the order. You can simply use main() to insert the data in sorted order. One can imagine schemes in which all the items from the place where a duplicate was discovered to the end of the array would be shifted down (left) one space every time a duplicate was discovered, but this would lead to slow O(N^2) time, at least when there were a lot of duplicates. In your algorithm, make sure no item is moved (left) more than once, no matter how many duplicates there are. This will give you an algorithm with O(N) time. You may not use a second array to remove the duplicates. Input: arr[] = {1, 2, 2,3,4,4,4,5,5) Output: arr[] = {1,2,3,4,5) new size = 5 Figure 3.2.1: Bubble sort algorithm. BubbleSort(numbers, numbersSize) { for (i = 0; i numbers [j+1]) { temp = numbers [j] numbers [j] = numbers [j + 1] numbers [j + 1] = temp } } 2 3 Feedback
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
