1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
denpristay [2]
3 years ago
9

Please HELP me it a test and it due rn. Please no links

Computers and Technology
1 answer:
kirill115 [55]3 years ago
7 0

Answer:

okay

Explanation:

wats the test about ?

send the topics to help you revise the content

You might be interested in
Create a Java program with threads that looks through a vary large array (100,000,000 elements) to find the smallest number in t
olchik [2.2K]

Answer:

See explaination

Explanation:

import java.util.Random;

public class Sample{

static class MinMax implements Runnable{

int []arr;

int start,end,min,max;

MinMax(int[]arr, int start,int end){

this.start=start;

this.end=end;

min=Integer.MAX_VALUE;

max=Integer.MIN_VALUE;

this.arr=arr;

}

atOverride

public void run() {

for(int i=start;i<=end;i++){ //search min and max form strant to end index

min=Math.min(min,arr[i]);

max=Math.max(max, arr[i]);

}

}

}

public static void main(String[] args) throws Exception{

long beginTime = System.nanoTime();

Random gen = new Random();

int n=100000000;

int[] data = new int[n]; //generate and fill random numbers

for(int i = 0; i < data.length; i++) {

data[i] = gen.nextInt()%1000000;

}

long endTime = System.nanoTime();

System.out.println("Done filling the array. That took " + (endTime - beginTime)/1000000000f + " seconds.");

//-----------------------------------------

System.out.println("Using 1 thread"); //1 thread

MinMax m1=new MinMax(data,0,n-1); //class object

Thread t1=new Thread(m1); //new thread

beginTime=System.nanoTime(); //start timer

t1.start(); //start thread

t1.join(0); //wait until thread finishes

endTime=System.nanoTime(); //end timer

System.out.println("Min,Max: "+m1.min+","+m1.max); //print minimum and maximum

System.out.println("Time using 1 thread " + (endTime - beginTime)/1000000000f + " seconds."); //print time taken

//-----------------------------------------

System.out.println("Using 2 thread");

m1=new MinMax(data,0,n/2);

MinMax m2=new MinMax(data,n/2+1,n-1);

t1=new Thread(m1);

Thread t2=new Thread(m2);

beginTime=System.nanoTime();

t1.start();

t2.start();

t1.join(0);

t2.join(0);

endTime=System.nanoTime();

System.out.println("Min,Max: "+ Math.min(m1.min,m2.min)+","+Math.max(m1.max,m2.max));

System.out.println("Time using 2 thread " + (endTime - beginTime)/1000000000f + " seconds.");

//-----------------------------------------

System.out.println("Using 3 thread");

m1=new MinMax(data,0,n/3);

m2=new MinMax(data,n/3+1,2*n/3);

MinMax m3=new MinMax(data,2*n/3+1,n-1);

t1=new Thread(m1);

t2=new Thread(m2);

Thread t3=new Thread(m3);

beginTime=System.nanoTime();

t1.start();

t2.start();

t3.start();

t1.join(0);

t2.join(0);

t3.join(0);

endTime=System.nanoTime();

System.out.println("Min,Max: "+ Math.min(Math.min(m1.min,m2.min),m3.min)+","+Math.max(Math.max(m1.max,m2.max),m3.max));

System.out.println("Time using 3 thread " + (endTime - beginTime)/1000000000f + " seconds.");

//-----------------------------------------

System.out.println("Using 4 thread");

m1=new MinMax(data,0,n/4);

m2=new MinMax(data,n/4+1,2*n/4);

m3=new MinMax(data,2*n/4+1,3*n/4);

MinMax m4=new MinMax(data,3*n/4+1,n-1);

t1=new Thread(m1);

t2=new Thread(m2);

t3=new Thread(m3);

Thread t4=new Thread(m4);

beginTime=System.nanoTime();

t1.start();

t2.start();

t3.start();

t4.start();

t1.join(0);

t2.join(0);

t3.join(0);

t4.join(0);

endTime=System.nanoTime();

System.out.println("Min,Max: "+ Math.min(Math.min(m1.min,m2.min),Math.min(m3.min,m4.min))+","+Math.max(Math.max(m1.max,m2.max),Math.max(m3.max,m4.max)));

System.out.println("Time using 4 thread " + (endTime - beginTime)/1000000000f + " seconds.");

}

}

6 0
3 years ago
What does CPC stand for?
Ahat [919]
I think it means cost per click depending on the actual context of why you need it.
Hope it helps
6 0
3 years ago
Read 2 more answers
The factorial of an integer N is the product of the integers between 1 and N, inclusive. Write a while loop that computes the fa
alexdok [17]

the function and loop will be

def factorial(x):

   total = 1

   if x != 1 and x != 0:

       for i in range(x,1,-1):

           total *= i

   return total

3 0
4 years ago
Using C++.
butalik [34]
Alright -

So, we're going to create an object of type Calculator, with no additional information (which would be passed in the form of parameters). 

We would do this by saying: 

<em>Calculator calc;
</em>
Hopefully, this helps you! =)
4 0
3 years ago
Select the correct answer.
Gnom [1K]

Answer:

CSS, HTML & JavaScript.

Explanation:

The first Murray will need to learn will be HTML for the site and then CSS for the design of the site.

Then he needs JavaScript to allow him make his showcase his pictures.

4 0
3 years ago
Other questions:
  • True or False? When shooting OTS shots of two actors / subjects speaking to each other, it is best to place the camera(s) over t
    10·1 answer
  • Does players report you on Mobile legends bang bang for playing your own Music while your playing yes or no
    11·1 answer
  • According to the Doppler effect, objects moving away from Earth would have a
    12·2 answers
  • How to connect xbox one controller
    5·1 answer
  • Which of the following is NOT a useful strategy when making an informed purchase ?
    7·1 answer
  • What are the "..........." called leading up to a page number?
    14·1 answer
  • Denise found a volume of documents in the trash bin that contained individuals, names, social security numbers and years of birt
    14·1 answer
  • Someone, please help me w/ king.com
    10·1 answer
  • What is a cell? how is it referred?​
    8·1 answer
  • How dose computers it use the information to solve problems
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!