– What is an algorithm?

277 views

– What is an algorithm?

In: 8

20 Answers

Anonymous 0 Comments

You know when Dad gets you Legos and you follow the steps to build those dinosaurs in the instructions? That’s an algorithm! You know how each instruction book is different? That’s because each instruction book is a different algorithm for building a different dinosaur with different pieces!

Anonymous 0 Comments

You know when Dad gets you Legos and you follow the steps to build those dinosaurs in the instructions? That’s an algorithm! You know how each instruction book is different? That’s because each instruction book is a different algorithm for building a different dinosaur with different pieces!

Anonymous 0 Comments

In a computer science class I took, algorithms were defined as a finite set of instructions which will produce an answer to a question with infinite variations.

The fact that the question must have infinite variations is only relevant because, if a question has a finite set of variations, then you could memorize all the possible answers and record them in a table somewhere and avoid using an algorithm.

In casual day-to-day usage, the word seems to refer to anything not-sentient which makes a decision.

Anonymous 0 Comments

In a computer science class I took, algorithms were defined as a finite set of instructions which will produce an answer to a question with infinite variations.

The fact that the question must have infinite variations is only relevant because, if a question has a finite set of variations, then you could memorize all the possible answers and record them in a table somewhere and avoid using an algorithm.

In casual day-to-day usage, the word seems to refer to anything not-sentient which makes a decision.

Anonymous 0 Comments

One thing that made me understand algorithms, is having to learn them to solve a Rubik’s cube. There’s repeated steps taken to solve any cube puzzle–any moving puzzle really. But, those repeated patterns are algorithms. I solve the Rubik’s cube the same way every time. If I mess up, cause I’m certainly no pro, that means I missed a completed turn in the algorithm, and I usually have to start over, or find where the pattern left off.

Anonymous 0 Comments

One thing that made me understand algorithms, is having to learn them to solve a Rubik’s cube. There’s repeated steps taken to solve any cube puzzle–any moving puzzle really. But, those repeated patterns are algorithms. I solve the Rubik’s cube the same way every time. If I mess up, cause I’m certainly no pro, that means I missed a completed turn in the algorithm, and I usually have to start over, or find where the pattern left off.

Anonymous 0 Comments

Thanks all for the explanations!

Anonymous 0 Comments

Thanks all for the explanations!

Anonymous 0 Comments

It is just a structured way of solving problems.

In computer science we usually mention an algorithm in the context of recursion; which means you call the same set of instructions multiple times to achieve an end result.

Say you have algorithm ‘mow lawn’, you might look at your lawn and say:

1 – Retrieve mower
2 – Start mower
3 – Mow row 1
4 – Mow row 2
5 – Mow row 3
6 – …7
7 – Pick up clippings
8 – Wake up neighbors with leaf blower
9 – Store all equipment

You can do that same task with recursion, and you can generalize it against lawns of all shapes and sizes by calling ‘mow row’ repeatedly and using general method to determine how many times you need to call the mow row function. Without recursion I have to program my instructions bespoke to the lawn I intend to mow. With recursion I can measure things and instead of listing out each row I need to mow; I might do something like:

1 – Measure the mower deck
2 – Measure the unmowed lawn
3 – x = width of (unmowed)lawn
4 – y = width of mower deck
5 – While x > y mow row <– I repeatedly mow until x is now longer greater than y, which should leave one strip (you don’t want to say ‘while x >= y’ because then you will never leave the loop)
6 – Mow last row
7 – Pick up clippings
8 …

Anonymous 0 Comments

It is just a structured way of solving problems.

In computer science we usually mention an algorithm in the context of recursion; which means you call the same set of instructions multiple times to achieve an end result.

Say you have algorithm ‘mow lawn’, you might look at your lawn and say:

1 – Retrieve mower
2 – Start mower
3 – Mow row 1
4 – Mow row 2
5 – Mow row 3
6 – …7
7 – Pick up clippings
8 – Wake up neighbors with leaf blower
9 – Store all equipment

You can do that same task with recursion, and you can generalize it against lawns of all shapes and sizes by calling ‘mow row’ repeatedly and using general method to determine how many times you need to call the mow row function. Without recursion I have to program my instructions bespoke to the lawn I intend to mow. With recursion I can measure things and instead of listing out each row I need to mow; I might do something like:

1 – Measure the mower deck
2 – Measure the unmowed lawn
3 – x = width of (unmowed)lawn
4 – y = width of mower deck
5 – While x > y mow row <– I repeatedly mow until x is now longer greater than y, which should leave one strip (you don’t want to say ‘while x >= y’ because then you will never leave the loop)
6 – Mow last row
7 – Pick up clippings
8 …