# Approaches for Efficiency Analysis of Algorithm

In this article, we discuss three most common approaches for efficiency analysis of algorithm.

The term “algorithm analysis” refers to the process of determining the resources required by the algorithm. Time, space, power usage, communication bandwidth, computer hardware, and so on are examples of resources.

The running time of an algorithm is proportional to the size of the problem. The amount of resources required grows in the order of linear, quadratic, factorial, and so on.

There may be more than one way to address the same problem. As a result, researchers are concerned with determining the optimal method. The efficiency of an algorithm is assessed by the amount of resources it requires.

Algorithm analysis provides an estimate of the resources necessary to tackle the given task. This aids in determining the optimal algorithm from among the set of candidate algorithms.

We don’t worry about performance if the problem is to be solved for a small number of instances. We could select the algorithm with the least amount of programming complexity. However, if a problem has to be solved repeatedly for a large number of instances, efficiency is important.

So, how should the optimal algorithm be chosen? All potential algorithms’ performance must be compared. The candidate of choice is the one who takes the least amount of time.

We are generally uninterested in space complexity because memory is no longer a major barrier, and it is becoming increasingly cost-effective. As a result, researchers are primarily concerned with increasing time complexity. Any algorithm can be analyzed in three ways:

## Empirical approach

An empirical approach is applied to the program. Various problem-solving strategies, such as greedy algorithm, dynamic programming, incremental approach, and so on, are turned into the programme and then tested on the computer for various input cases.

This method is also known as a posterior approach. It is also possible to test an algorithm for a large number of instances.

## Theoretical approach

The necessary resources are estimated mathematically in this approach. This strategy is also known as the priori approach because it is immediately applied to an algorithm that has yet to be changed in the program.

The algorithm is evaluated for many scenarios. The size of the problem is not measured in bits or bytes, but in the number of items in the problem.

In sorting issues, the size of an instance is the number of elements to be sorted. The size of the challenge for traversing the linked list is a number of nodes. The size of a graph problem is determined by the number of edges and vertices.

A character, integer, float, double, or any other data type may be used as an input element. We aren’t concerned with how much RAM each piece of the input list takes up.

• As this approach is assessed on paper, it is independent of the programmer’s talent, the capacity of the machine, the strength of the programming language, and everything else.
• It saves a lot of coding time because it has already been tested.

• Because the algorithm is tested on hand in this approach, it cannot be traced for huge input.
• It is impossible to comment on the behavior of an algorithm until it has been tested for enormous input sizes.

## Hybrid approach

It combines the best aspects of the priori and posterior approaches. The theoretical technique is used to determine the function characterizing the algorithm’s efficiency, and the empirical approach is used to derive the requisite numerical parameters by running a program on the machine.

On a computer, required parameters are found using regression algorithms.

The time requirement is predicted by testing it for tiny instances using the priori technique, and it may be verified by running it for big cases on the actual system using the posterior approach.

However, such an approach may fail at times due to a lack of theoretical basis.

Thus, the approaches for efficiency analysis of algorithm describes the different ways of how we can effectively analyze the algorithm. Each method has its pros and cons.