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
Natasha_Volkova [10]
3 years ago
12

) Suppose algorithm A takes 10 seconds to handle a data set of 1000 records. Suppose the algorithm A is of complexity O(n2). Ans

wer the following: (i) Approximately how long will it take to handle a data set of 1500 records? Why? (ii) How long will it take to handle a data set of 5000 records? Can you come up with a reason why this will not be entirely accurate but will just be an approximation?
Computers and Technology
1 answer:
Mice21 [21]3 years ago
8 0

Answer:

i) The time taken for 1500 records = 15 seconds.

ii) The time taken for 1500 records = 50 seconds.

Explanation:

A is an O(n) algorithm.

An algorithm with O(n) efficiency is described as a linearly increasing algorithm, this mean that the rate at which the input increases is linear to the time needed to compute that algorithm with n inputs.

From the question, it is given that for 1000 records, the time required is: 10 seconds.

Algorithm time taken is O(n)

Hence,

1) For 1,500 records

=> 10/1000 = x/1500

=> 10x1500/1000 = x

x = 15 seconds

Thus, the time taken for 1500 records = 15 seconds.

2) For 5,000 records

=> 10/1000 = x/5000

=> 10x5000/1000 = x

x = 50 seconds

Thus, the time taken for 1500 records = 50 seconds.

You might be interested in
Q. Differentiate between language and package.
Burka [1]

Answer:

Language is made up of syntactic norms and semantics since it is a resource which we use to develop computer programs and solve problems. The package, on the other hand, is a type of folder since it is a collections of linked and pre-defined classes. Furthermore, a package is designed for a certain set of tasks which  has a limited computational capability. So, language has a set of rules and syntax for creating data encapsulation, whereas package has a chain of conditions for building menu action programs and applications.

4 0
2 years ago
Many programming languages require a ____ to create executable files.
Nadya [2.5K]
Most languages require a compiler. This is because machine code consists of only 0s and 1s, which is executable. All other languages have to be translated into machine language by a compiler.
4 0
4 years ago
Respond to the following in 2-5 paragraphs. Give an example of how you can demonstrate active listening.
nadezda [96]
Hey my name is ..... and this do the thesis
8 0
3 years ago
Variance for accumulator. Validate that the following code, which adds the
Art [367]

Using the knowledge of computational language in JAVA it is possible to write a code that Validate that the following code, which adds the methods var() and stddev() to Accumulator, computes both the mean and variance of the numbers presented as arguments to addDataValue()

<h3>Writting the code:</h3>

<em>import java.util.*;</em>

<em>public class </em><em>Accumulator </em><em>{  </em>

<em>private static double m;   </em>

<em>private static double v;   </em>

<em>private static double st;   </em>

<em>private static  double s[]=new double[5]; </em>

<em>private static int N;</em>

<em>private static int count =0;</em>

<em>public static void main(String[] args) {</em>

<em>// TODO Auto-</em><em>generated </em><em>method stub</em>

<em>Random r = new Random();</em>

<em>System.out.println("hello world");</em>

<em>for(int i=0;i<5;i++) {</em>

<em>    double randomvalue = r.nextDouble();</em>

<em>addDataValue(randomvalue);</em>

<em>}</em>

<em>for(int i=0;i<s.length;i++) {</em>

<em>    System.out.println("dataValue:"+s[i]);</em>

<em>}   </em>

<em>mean();</em>

<em>System.out.println("mean:"+m);</em>

<em>var();</em>

<em>System.out.println("variance:"+v);</em>

<em>stddev();</em>

<em>System.out.println("standard deviation:"+st);</em>

<em>}</em>

<em>public  static void </em><em>addDataValue</em><em>(double value) {     // addes data values to array</em>

<em>  s[count]=value;</em>

<em>  count++;</em>

<em> }</em>

<em>public static double mean() {        // returns mean</em>

<em>double sum=0.0;</em>

<em>for(int i=0;i<s.length;i++) {</em>

<em>    sum+=s[i];</em>

<em>}</em>

<em>m = sum/s.length;</em>

<em> return m;</em>

<em>}   </em>

<em>public </em><em>static </em><em>double var() {    //returns variance</em>

<em>double mm = mean();</em>

<em>     double t = 0;</em>

<em>     for(int i=0;i<s.length;i++) {</em>

<em>         t+= (s[i]-mm)*(s[i]-mm);</em>

<em>} </em>

<em>     v= t/(s.length-1);</em>

<em>      return v;  </em>

<em>}</em>

<em>public static  double </em><em>stddev</em><em>() {        // returnsn the stardard deviation </em>

<em>st= Math.sqrt(var());</em>

<em>return st;</em>

<em>}</em>

<em>}</em>

See more about JAVA at brainly.com/question/12975450

#SPJ1

3 0
1 year ago
Show the printout of the following code. public class Test { public static void main(String[] args) { double[][] m = {{1, 2, 3},
gtnhenbr [62]

Answer:

The answer to the given question is "3.6".

Explanation:

The printout description of the given java program can be given as:

In this program, the printout of the following code is 3.6. because in this program we define an array and assign elements on the array and calculate the sum of the elements but in the loop, we calculate the sum of rows value that is i [1][1]= 1.0, i [2][2]=2.5 and i [3][3]=0.1  then we calculate sum that is equal to 3.6.

That's why the answer to this question is "3.6".  

7 0
4 years ago
Other questions:
  • To close a window in Windows 10, you can _____. Select all that apply. A. right-click its button on the taskbar, then click Clos
    11·1 answer
  • Operational feasibility, which refers to user acceptance and support, as well as management acceptance and support, is also know
    9·1 answer
  • Apollo Couriers, a company providing international express mail services, has a proactive customer communications team. The prim
    8·1 answer
  • What is qwerty and why is it on the keyboard?
    15·2 answers
  • When creating a document template, you can either start from an existing document or begin from _____.
    15·1 answer
  • The leader in student travel who provides educational tours at affordable prices is called?
    8·1 answer
  • As a prospective student, what is the best reason to request an interview with your college application?
    6·1 answer
  • The most common threats to your computer and your online safety come from what is called ____
    11·2 answers
  • Basic python coding, What is the output of this program? Assume the user enters 2, 5, and 10.
    8·1 answer
  • Which component of the computer keeps the operating system when the computer is running​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!