What is a algorithm
An algorithm is defined as the finite sequence of instruction, each of which has a clear meaning and can be perform with a finite amount of effort in a finite length of time.
In other words an algorithm is a sequence of step to solve a problem.
They may be more than one algorithm to solve a problem.
Algorithm design
An algorithm can design in two ways
- Top down design
- Bottom up design
Algorithm complicity
There are two types of complexity of an algorithm
- Time complexity
- Space complexity
Time complexity
The time complexity of an algorithm is an amount of time. It needs to run to completion. Some of the reasons to reading time complexity.
- We may be interested to know in advance Whether the program will provide a satisfactory a real time response .
- There may be several possible solution with different time requirements.
Space complexity
the space complicity of an algorithm is an amount of memory it needs to run to completion.
Some of the reason to study space complexity are as following
There may be several possible solution without different space requirement.
To estimate the size of the largest problem that a program canb solve.