Skip to content

Commit 962e0e9

Browse files
committed
Pancakes!
1 parent d9ac8e2 commit 962e0e9

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

README.markdown

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ This is a work in progress. More algorithms will be added soon. :-)
1212

1313
## Important links
1414

15+
[What are algorithms and data structures?](What are Algorithms.markdown)
16+
1517
[Why learn algorithms?](Why Algorithms.markdown) Worried this isn't your cup of tea? Then read this.
1618

1719
[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.

What are Algorithms.markdown

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# What are algorithms and data structures?
2+
3+
An algorithm is a recipe for making the computer do something. If you know how to cook, you understand algorithms!
4+
5+
Here's a [recipe for pancakes](http://allrecipes.com/recipe/21014/good-old-fashioned-pancakes/):
6+
7+
1. In a large bowl, sift together flour, baking powder, salt and sugar.
8+
2. Pour in the milk, egg, and melted butter.
9+
3. Mix until smooth.
10+
4. Heat a frying pan over medium heat.
11+
5. Scoop the batter into the pan, using approximately 1/4 cup for each pancake.
12+
6. Brown the pancake on both sides.
13+
14+
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.
15+
16+
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!).
17+
18+
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 commit comments

Comments
 (0)