Spiced Apple Smoothie

2 apples peeled & chopped
2 banannas
2 cups of ice
3/4 cup apple juice
6 oz. of vanilla yogurt
3 tbsp brown sugar
1-2 tsp of cinnamon
Blend all together in blender
For garnish, add whipped cream, cinnamon, & an apple slice.

Math trickery for 1D & 2D arrays

Once upon a time, there was a language that didn’t have 2 dimensional arrays. This greatly upset the programmer. Fortunately, the programmer was swift in the art of arithmetic and overcame this obstacle easily.

Lets say for example, we only have access to a 1 dimensional array data structure and it has 50 elements in it.

Lets break this array up into 10 rows and 5 columns to make a grid. So how do we get access to a position say data[4][3]?
There are two things I’m going to teach you now:
1) Retrieve the column & row numbers from a linear index counter.
2) Retrieve the index from a row & column numbers.

Before I continue, i want you to notice that the row and column numbers are zero based. So they start at zero, not one.

Lets do #1 first:

Read the rest of this entry »