Skip to content

Commit

Permalink
Pancakes!
Browse files Browse the repository at this point in the history
  • Loading branch information
hollance committed Feb 10, 2016
1 parent d9ac8e2 commit 962e0e9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ This is a work in progress. More algorithms will be added soon. :-)

## Important links

[What are algorithms and data structures?](What are Algorithms.markdown)

[Why learn algorithms?](Why Algorithms.markdown) Worried this isn't your cup of tea? Then read this.

[Big-O notation](Big-O Notation.markdown). We often say things like, "This algorithm is **O(n)**." If you don't know what that means, read this first.
Expand Down
18 changes: 18 additions & 0 deletions What are Algorithms.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# What are algorithms and data structures?

An algorithm is a recipe for making the computer do something. If you know how to cook, you understand algorithms!

Here's a [recipe for pancakes](http://allrecipes.com/recipe/21014/good-old-fashioned-pancakes/):

1. In a large bowl, sift together flour, baking powder, salt and sugar.
2. Pour in the milk, egg, and melted butter.
3. Mix until smooth.
4. Heat a frying pan over medium heat.
5. Scoop the batter into the pan, using approximately 1/4 cup for each pancake.
6. Brown the pancake on both sides.

The recipe consists of a series of steps that you perform one after the other. An algorithm is just like that, except that it contains instructions for a computer to perform, not for a cook.

The ingredients -- flour, milk, eggs, butter -- are the data that the algorithm works on. The data goes into the algorithm in one form (raw, separate ingredients) and comes out in another (delicious pancakes!).

So what are the data structures? They are the containers that hold the data while the algorithm works on it. In the pancake recipe, the data structures are the bag that holds the flour, the mixing bowl where you combine everything, the frying pan that browns the pancake, and finally the plate used to serve the finished pancake.

0 comments on commit 962e0e9

Please sign in to comment.