Computer Algorithm
About Computer Algorithm
To make a computer do anything, you have to write a computer program. To write a computer
program, you have to tell the computer, step by step, exactly what you want it to do. The computer
then "executes" the program, following each step mechanically, to accomplish the end goal.
When you are telling the computer what to do, you also get to choose how it's going to do it. That's
where computer algorithms come in. The algorithm is the basic technique used to get the job done.
Let's follow an example to help get an understanding of the algorithm concept.
Let's say that you have a friend arriving at the airport, and your friend needs to get from the airport
to your house. Here are four dierent
algorithms that you might give your friend for getting to your
home:
• The taxi algorithm:
- Go to the taxi stand.
- Get in a taxi.
- Give the driver my address.
• The call-me algorithm:
- When your plane arrives, call my cell phone.
- Meet me outside baggage claim.
• The rent-a-car algorithm:
- Take the shuttle to the rental car place.
- Rent a car.
- Follow the directions to get to my house.
• The bus algorithm:
- Outside baggage claim, catch bus number 70.
- Transfer to bus 14 on Main Street.
- Get o
- Walk two blocks north to my house.
All four of these algorithms accomplish exactly the same goal, but each algorithm does it in
completely dierent
way. Each algorithm also has a dierent
cost and a dierent
travel time. Taking a
taxi, for example, is probably the fastest way, but also the most expensive. Taking the bus is denitely
less expensive, but a whole lot slower. You choose the algorithm based on the circumstances.
In computer programming, there are often many dierent
ways -- algorithms -- to accomplish any
given task. Each algorithm has advantages and disadvantages in dierent
situations. Sorting is one
place where a lot of research has been done, because computers spend a lot of time sorting lists.
Here are five different algorithms that are used in sorting:
• Bin sort
• Merge sort
• Bubble sort
• Shell sort
• Quick sort
If you have a million integer values between 1 and 10 and you need to sort them, the bin sort is the
right algorithm to use. If you have a million book titles, the quicksort might be the best algorithm. By
knowing the strengths and weaknesses of the dierent
algorithms, you pick the best one for the task
at hand.
Hi! I am a robot. I just upvoted you! I found similar content that readers might be interested in:
https://computer.howstuffworks.com/what-is-a-computer-algorithm.htm
✅ @suryanharsh, I gave you an upvote on your post! Please give me a follow and I will give you a follow in return and possible future votes!
Thank you in advance!
Congratulations @suryanharsh! You received a personal award!
You can view your badges on your Steem Board and compare to others on the Steem Ranking
Vote for @Steemitboard as a witness to get one more award and increased upvotes!