Algorithm : Computer Science
To understand algorithm you need to understand following terms
- Computer is a combination of software and hardware.
- Hardware is physical component of system which we can touch and feel.
- Software is a collection of related program.
- Program is a combination of related statement.
- Statements are actual command which computer follows to perform an action.
As we know in computer a problem is solved step by step not once. So there is a need to instruct computer how to solve a specific problem step by step with the help of algorithm.
Algorithm is design by the expert is a mathematical step by step way to accomplish some programming task. You can measure the time and space complexity of an algorithm which helps in decision making that which algorithm is best for our problem. Algorithm standardizes programming activity.
Let's say that you are going somewhere and heading to airport, after landing your destination you need to get reach airport to your hotel. So here are four different algorithms that you might use for getting to your hotel:
The taxi algorithm:
- Go to the taxi stand.
- Get in a taxi.
- Give the driver my address.
The call-hotel algorithm:
- When your plane landed to the airport, then Inquiry for your hotel.
- Meet me outside baggage claim.
The rent-a-car algorithm:
- Rent a car.
- Follow the directions to get to my Hotel.
The bus algorithm:
- Outside baggage claim, catch bus number 70.
- Transfer to bus 14 on Royal Place Hotel.
- Get off on Elm street.
- Walk two blocks north to my hotel.
All four of these algorithms accomplish exactly the same goal, but each algorithm does it in completely different way. Each algorithm also has a different cost and a different travel time. Taking a taxi, for example, is probably the fastest way, but also the most expensive. Taking the bus is definitely less expensive, but a whole lot slower. You choose the algorithm based on the circumstances.
Formal Example of famous existing algorithm in computer science
- Sorting algorithm
- Bubble sort
- Selection Sort
- Merge Sort and many more
- Dijkastra Algorithm (Graph Node Visit)