answersLogoWhite

0


Best Answer

Different algorithms do different things, so it makes no sense to compare them. For example, the accumulate algorithm is an algorithm which performs the same operation upon every element of a container, whereas a sorting algorithm sorts the elements of a container. Each specific algorithm requires a different set of concepts. An accumulate algorithm requires a data sequence with at least forward iteration and elements which support the operation to be performed, whereas a sorting algorithm generally requires random access iterators and elements that support a given comparison operation (such as the less-than operator).

Even if two algorithms have the exact same time and space complexities, it does not follow that both will complete the task in the same time. For instance, the accumulate algorithm is a linear algorithm with a time-complexity of O(n) regardless of which operation is being performed. However, the complexity of the operation itself can greatly affect the actual time taken, even when the operations have exactly the same time-complexity. For instance, if we use the accumulate algorithm in its default form (to sum all the elements in a data sequence), the operation itself has a constant-time complexity of O(1). If we choose another operation, such as scaling each element and summing their products, it will take much longer to complete the algorithm (possibly twice as long) even though the operation itself has the exact same time-complexity, O(1).

Consider the time-complexity of adding one value to another:

a += b

This has to be a constant-time operation because the actual values of a and b have no effect upon the time taken to produce a result in a. 0 += 0 takes exactly the same number of CPU cycles as 42 += 1000000.

Now consider the operation to scale and sum:

a += b * 42

Here, 42 is the scalar. This also has to be a constant-time operation, but it will take longer to physically perform this operation compared to the previous one because there are more individual operations being performed (roughly twice as many).

The only way to compare algorithms is to compare those that achieve exactly the same goal but do so in different ways. Only then does comparing their respective time-complexity make any sense. Even so, time-complexity is merely an indication of performance so two sorting algorithms with the exact same time-complexity could have very different runtime performance (it depends on the number and type of operations being performed upon each iteration of the algorithm). Only real-world performance testing can actually determine which algorithm gives the best performance on average.

With sorting algorithms, we often find one algorithm ideally suited to sorting small sequences (such as heap sort) and others ideally suited to larger sets (such as merge sort). Combining the two to create a hybrid algorithm would give us the best of both worlds.

User Avatar

Wiki User

6y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: WHAT IS THE DIFFERENT algorithm of advantage and amp disadvantage?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What happens when magnitude of Vcc and Vee of op-amp are different?

When the magnitude of Vcc and Vee of op-amp are different the op-amp produces waveforms equal in the size of each rail.


What is the advantage of using external compensation for an op amp?

because it helps in noise reduction,bandwidth maximization


What terms of measurement begin with the letter a?

· acute angle· algorithm· altitude· angle· area· arc· axisMath words A: * add * addition * angle * average * algebra * answer * axiom * analyze * axis * algorithm * area (as in find the area of a square)adding, algebra


What is difference between 5 amp and 15 amp plug points?

Current carrying capacity is different.


Is a bass amp cheaper then a guitar amp?

The cost nearly exactly the same in all different stages of quality.


What is the guitar amp settings on flyleafs songs?

They probably have different settings for different songs.


How many amp is 21 volts?

sorry different units.


What is the amp rating for?

Total battery amp hours of the battery, divided by the amp draw, equals the life of the battery.Example=200 amp hours, divided by 5 amps, equals 40.00 hours.There are many different factors. This is based on constant draw.


How long do amp hours last?

If you draw one amp of power for 1 hour that is an amp hour . If you have a different load eg a heater drawing 3 amp , it would be 20 minutes . Divide the hour ( 60 mintues ) by the amps you draw .


What amp is good for a bc rich guitar?

It's all about personal preference. Every amp sounds different. Even the same model.


What is the different between a volt and a amp?

Liken volt and amp to a water in a pipe. Voltage is the water pressure in the pipe and amperage is the water flow through the pipe. They are two completely different electrical units.


Is there any disadvantage of selecting over rated circuit breaker?

If i understand you correctly, yes there certainly can be. If you replace, say a 10 amp breaker with a 20 amp. you are losing the safety factor - the whole purpose of the breaker to begin with. Always replace a breaker with the exact same amperage rating!