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
Xelga [282]
3 years ago
13

2) An algorithm that takes in as input an array with n rows and m columns has a run time of O(nlgm). The algorithm takes 173 ms

to run in an input array with 1000 rows and 512 columns. How long will the algorithm take to run on an input array with 1500 rows and 4096 columns? (Note: For ease of calculation, please use a base of 2 for your logarithm.)
Computers and Technology
1 answer:
mr Goodwill [35]3 years ago
8 0

Answer:

The algorithm takes 346 ms to run on an input array with 1500 rows and 4096 columns.

Explanation:

For an input array with 1000 rows and 512 columns, the algorithm takes 173 ms.

We want to find out how long will the algorithm take to run on an input array with 1500 rows and 4096 columns?

Let the algorithm take x ms to run 1500 rows and 4096 columns.

For an input of n rows and m columns, it takes

n \: log_{2} \:m

So,

1000 \: log_{2} \:512 = 173  \\\\1000 \: log_{2} \:2^{9}  = 173 \:\:\: ( 2^{9} = 512)  \\\\1000 \times 9  = 173 \:\:\:\:\: \: \: eg. 1

and

1500 \: log_{2} \:4096 = x  \\\\1500 \: log_{2} \:2^{12}  = x \:\:\: ( 2^{12} = 4096)  \\\\1500 \times 12  = x \:\:\:\:\: \: \: eg. 2

Now divide the eq. 2 by eq. 1 to find the value of x

\frac{1500 \times 12}{1000 \times 9}   = \frac{x}{173}  \\\\\frac{18000 }{9000}   = \frac{x}{173}  \\\\2   = \frac{x}{173}  \\\\x = 2 \times 173 \\\\x = 346 \: ms

Therefore, the algorithm takes 346 ms to run on an input array with 1500 rows and 4096 columns.

You might be interested in
2. Use inheritance to create a hierarchy of Exception classes -- EndOfSentenceException, PunctuationException, and CommaExceptio
Lelechka [254]

Answer:

See explaination

Explanation:

EndOfSentenceException.java

//Create a class EndOfSentenceException that

//extends the Exception class.

class EndOfSentenceException extends Exception

{

//Construtor.

EndOfSentenceException(String str)

{

System.out.println(str);

}

}

CommaException.java

//Create a class CommaException that extends the class

//EndOfSentenceException.

class CommaException extends EndOfSentenceException

{

//Define the constructor of CommaException.

public CommaException(String str)

{

super(str);

}

}

PunctuationException.java

//Create a class PunctuationException that extends the class

//EndOfSentenceException.

class PunctuationException extends EndOfSentenceException

{

//Constructor.

public PunctuationException(String str)

{

super(str);

}

}

Driver.java

//Include the header file.

import java.util.Scanner;

//Define the class Driver to check the sentence.

public class Driver {

//Define the function to check the sentence exceptions.

public String checkSentence(String str)

throws EndOfSentenceException

{

//Check the sentence ends with full stop,

//exclamation mark

//and question mark.

if(!(str.endsWith(".")) && !(str.endsWith("!"))

&& !(str.endsWith("?")))

{

//Check the sentence is ending with comma.

if(str.endsWith(","))

{

//Throw the CommaException.

throw new CommaException("You can't "

+ "end a sentence in a comma.");

}

//Otherwise.

else

{

//Throw PunctuationException.

throw new PunctuationException("The sentence "

+ "does not end correctly.");

}

}

//If the above conditions fails then

//return this message to the main function.

return "The sentence ends correctly.";

}

//Define the main function.

public static void main(String[] args)

{

//Create an object of Scanner

Scanner object = new Scanner(System.in);

//Prompt the user to enter the sentence.

System.out.println("Enter the sentence:");

String sentence=object.nextLine();

//Begin the try block.

try {

//Call the Driver's check function.

System.out.println(new

Driver().checkSentence(sentence));

}

//The catch block to catch the exception.

catch (EndOfSentenceException e)

{}

}

}

5 0
3 years ago
You're an administrator for a large corporation and you are responsible for deploying computers often and quickly. What server d
fomenos

Answer: it used the keyboard and apps

6 0
3 years ago
In what decade was photography invented? the 1800s the 1820s the 1840s the 1860s
frutty [35]

Answer:

In the year 1820's

It is B

4 0
3 years ago
Drag each tile to the correct box.
Arte-miy333 [17]

Answer:

Explanation:

web server= stores text, images, and other media that make up a website

email server= stores and exchanges messages

Proxy server= filters content and stores data for faster access

FTP server= stores and provides files for download

7 0
3 years ago
Read 2 more answers
In short and brave what is technology?
emmainna [20.7K]

Answer:

technology is a whole means to provide goods needed for the survival and comfort of human life

8 0
3 years ago
Read 2 more answers
Other questions:
  • This provides an easy method for workers to use their computers.
    11·2 answers
  • How many times do you usually use npm?<br> Put your answer in the box.
    6·1 answer
  • an object or device outside the computer, that one would plug into a port to control the functions of a computer are?
    9·2 answers
  • What were the goals of the “paperless society” ideal?
    14·2 answers
  • 1. What are copyright laws? (6 points)
    15·1 answer
  • You are implementing a new application control solution. Prior to enforcing your application whitelist, you want to monitor user
    5·1 answer
  • Every Java statement ends with: *<br><br> Period<br> Colon<br> Double quote<br> Semicolon
    11·2 answers
  • We begin with a computer implemented in a single-cycle implementation. When the stages are split by functionality, the stages do
    13·1 answer
  • B. WAP to check whether input number is palindrome number or not using SUB...... END SUB.​
    15·1 answer
  • a network administrator for a large oil company has discovered that a host on the company network has been compromised by an att
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!