Search

# What is Algorithm ??

What are Algorithms (both in general and CS perspective)?

The word Algorithm means “a process or set of rules to be followed in calculations or other problem-solving operations”. Therefore Algorithm refers to a set of rules/instructions that step-by-step define how a work is to be executed to get the expected results. Why do we need Algorithms

Computers can only do a limited number of operations in a given time, usually about a billion operations per second. So we need an optimistic algorithm to complete the Operation efficiently.

What are the characteristics of an Algorithm?

• Clear and Unambiguous: The Algorithm should be clear and unambiguous. Each of its steps should be clear in all aspects and must lead to only one meaning.

• Well-Defined Inputs: If an algorithm says to take inputs, it should be well-defined inputs.

• Well-Defined Outputs: The Algorithm must clearly define what output will be yielded, so it should be well-defined as well.

• Finite-ness: The Algorithm must be finite, so it should not end up in infinite loops or similar.

• Feasible: The Algorithm must be simple, generic, and practical. It must not contain some future technology or anything.

• Language Independent: The Algorithm designed must be language-independent, so it must be just plain instructions that can be implemented in any language, and yet the output will be the same, as expected.

How do we decide, if an algorithm will work for our task?

If the Algorithm gives correct output efficiently to the given task, then we consider that the Algorithm is working perfectly.

What is Time Complexity?

In computer science, the time complexity is the computational complexity that describes the amount of time it takes to run an algorithm.

What is Space Complexity?

The space complexity of an algorithm or a computer program is the amount of memory space required to solve an instance of the computational problem as a function of characteristics of the input. It is the memory occupied by an algorithm until it executes completely.

Algorithm efficiency

The efficiency of an algorithm is mainly defined by two factors space and time. A good Algorithm takes less time and less space, but this is not possible all the time. There is a trade-off between time and space. If you want to reduce the time, then space might increase. Similarly, if you want to overcome the space occupation, then the time may increase. So, you have to compromise with either space or time.