Algorithm is step by step finite and systematic process which defines how particular problem can be solved to derive a desirable solution. How to make a tea? There is specific process to make a tea, and that’s algorithm. How to capture photos in old reel camera? First you need to open camera .Second you may set exposure, aperture length according your requirement and then you may click the button. Third is the last process and that’s developing your photos will be ready.This is also another example of algorithms. Algorithms are needed everywhere. From NASA satellite changing its solar panel orientation with respect to sunlight to your refrigerator which can change its working temperature according to ambient temperature.
Computers and Algorithm
Common stereotype includes people thinking algorithms are something related to computer. It’s true that computer and algorithms are related because algorithms define particular process. Computer on its core has only one work and that is to calculate. Computer means computing devices . Algorithms do define how computer should start , how computers should interact with your input and how it should process output and present output.Basically it is calculating everything or it is computing and algorithms define how it should calculate with respect to your input.
Characteristics of Computer Algorithms
There are certain properties of algorithms that makes more sense for you to understand what algorithms are all about;
- Input/Output : Algorithm should be able to receive input and input should be specific.i.e if algorithms demands number only it should not accept alphabets.It should provide output with respect to input.
- Unambiguous or Definiteness : The steps should be properly defined and it should always lead to one solution or it should always have one interpretation.
- finiteness : Algorithms should end in finite number of steps.
- Feasibility : Algorithms should be efficient as possible and should not demand more resources than the capability of computer.
Example of Algorithm
Algorithm to add two numbers taken from input might be the simplest example of algorithm and you may see everywhere which tries to describe algorithm and it can be avoided. To understand the power of algorithm lets take this example into account:
Algorithm to find the profit or loss for the shirt.
step 2: Input real price and store in realPrice.
step 3: Input selling price and store in sellPrice.
step 4: If sellPrice is greater than realPrice then print profit.
or print loss
step 5: end