Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Implement a sort by following the following steps:a. Implement a program in Java that creates an array of n items (n being determined by the user) ofrandom integers of between 0 and 100.b. Manually...

1 answer below »
Implement a sort by following the following steps:a. Implement a program in Java that creates an array of n items (n being determined by the user) ofrandom integers of between 0 and 100.b. Manually “Seed” it (open it in notepad or something) with a number greater than 100 near the endof the array – i.e. a number clearly not belonging to the set which we will be searching for later.c. Implement a simple linear search program in Java that calls a method which finds the integergreater than 100. Also output to the screen how many items had been inspected before the matchwas made.d. Sort the original seeded array using the bubble sort algorithm below.i. Display the data before and after the sort. You’ll see that scrolling the display takes a longtime. Comment out the calls to display() so you can see how long the sort itself takes. Thetime will vary on different machines. Sorting 100,000 numbers will probably take less than30 seconds.ii. Write this sorted list into another separate array.public int[] bubbleSort(int[] data){int lenD = data.length;int tmp = 0;for(int i = 0;ifor(int j = (lenD-1);j>=(i+1);j--){if(data[j]tmp = data[j];data[j]=data[j-1];data[j-1]=tmp;}}}return data;}
Answered Same Day Jun 12, 2020

Solution

Sonu answered on Jun 16 2020
141 Votes
Program/Screenshots/1.Random Number.JPG
Program/Screenshots/2.Program.png
Program/Screenshots/3.LinearSearchMethod.JPG
Program/Screenshots/4.Bu
leSort.JPG
Program/Source code/2.Random.zip
Random/.classpath

    
    
    
Random/.project

     Random
    
    
    
    
        
             org.eclipse.jdt.core.javabuilde
            
            
        
    
    
         org.eclipse.jdt.core.javanature
    
Random/.settings/org.eclipse.jdt.core.prefs
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=e
o
org.eclipse.jdt.core.compiler.problem.enumIdentifier=e
o
org.eclipse.jdt.core.compiler.source=1.8
Random
in/file.txt
3 4 4 5 7 8 8 9 9 13 14 14 17 17 18 18 19 20 21 22 26 26 27 27 28 31 31 32 32 35 35 38 38 40 42 43 44 44 45 46 46 48 49 50 50 50 50 51 53 55 56 60 60 60 61 63 63 64 64 65 65 66 66 69 70 71 72 76 77 78 79 80 80 82 83 83 84 86 87 87 89 89 91 93 94 94 95 95 95 97
Random
in/Main.class
public synchronized class Main {
public void Main();
public static void main(String[]);
}
Random
in/RandomGen.class
public synchronized class RandomGen {
int[] randomElements;
public void RandomGen();
public int[] fillA
ay();
}
Random/file.txt
7 15 53 64 71
Random/src/file.txt
1 36 50 61 64 73 77 92...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here