answersLogoWhite

0

An algorithm cannot be measured in seconds because:

* timing will be different on different machines * timing will be different on the same machine in a different configuration * when an algorithm takes n seconds to complete, that only holds true for one set of input

The biggest problem up there is that timing an algorithm only gives us information about one output for a specific input. What we really want to know is how well the algorithm will scalewith input. If you double the number of values you send as input will your algorithm take twice as long? Four times? Will it not scale linearly?

In computer science we use what is known as "Big O notation" to describe how well an algorithm scales. Let's look at some common examples:

Linear search can be represented in Big O as O(n). This is because the algorithm searches through each element in your list one at a time until it finds the target value. For a list of any size n, it will make n comparisons.

Selection sort can be represented as O(n2) for the same reason. For a list of size n, each element will need to be compared to each other element, giving us n*n comparisons.

More complex algorithms have more difficult evaluations.

A binary search algorithm will cut the amount of data it needs to search in half on each iteration. This gives us O(log n).

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

What are disadvantages of cognitive interview?

different police forces use different aspects of the CI technique so its difficult to evaluate its effectiveness fully


What is Pharmacoeconomics?

Pharmacoeconomics evaluate the effectiveness of existing and new prescription drugs in relation to their risks and costs. It is the study of how medications are used by physicians and patients; it helps to develop methods for optimal prescription drug use.


What is the significance of efficiency in computer science and how does it impact the performance of algorithms and systems?

Efficiency in computer science is crucial as it determines how quickly and effectively algorithms and systems can perform tasks. Efficient algorithms and systems can process data faster, use fewer resources, and deliver results more quickly. This leads to improved performance, reduced costs, and better user experiences. In contrast, inefficient algorithms and systems may be slow, resource-intensive, and less reliable, resulting in slower performance and higher costs. Therefore, optimizing efficiency in computer science is essential for achieving optimal performance and maximizing the effectiveness of algorithms and systems.


How can we use plague in a sentence?

These algorithms always plague me with their complexity!


Why you use section in assembly language?

I section in assembly to speed up algorithms that use.


Does the use of antibiotics interfere with the effectiveness of birth control"?

Yes, the use of antibiotics can interfere with the effectiveness of birth control.


What do you use to evaluate the observation?

A hypothesis


What is formative assessment in health and physical education?

A formative assessment is any assessment made during the course of a program to evaluate effectiveness. It is important that you establish a baseline by assessing prior to implementing a program so that when you use a formative assessment you can actually analyze the results. The formative assessment in health and PE would be determined based on what you are looking to evaluate.


What are the Prim and Kruskal algorithms?

we use them to find minimum spanning trees.


How do you unscramble a rubix cube?

there are specific algorithms that you can use or find on the Internet.


Briefly the methods you will use to monitor marketing effectiveness and performances?

briefly, the methods you will use to monitor marketing effectiveness and performance


What is a symmetric encryption?

Symmetric-key algorithms are a class of algorithms for cryptography that use trivially related, often identical, cryptographic keys for both decryption and encryption.