Problems? Is your data what you think it is? PerlMonks

Re^3: why the array index has to start at 0??

by ikegami (Pope)
 on Jun 23, 2009 at 15:17 UTC ( #774057=note: print w/replies, xml ) Need Help??

we never call first as "0", we always call first as '1'. so this lead to this thinking.

Really?

• The first km my car drove was km 0000000 on the odometer.
• The first inch on a ruler is inch zero.
• The first century AD was century zero.
• The first raffle ticket on the spool is xxx000.

It's not exactly a foreign concept.

• Comment on Re^3: why the array index has to start at 0??

Replies are listed 'Best First'.
Re^4: why the array index has to start at 0??
by AnomalousMonk (Chancellor) on Oct 13, 2013 at 07:21 UTC
The first century AD was century zero.

I thought the first century A.D. was century 1, the first year of which was year 1 A.D. (with the year before being 1 B.C.), the concept of "zero" not percolating into European thought until some non-zero number of centuries later. Which is why, twenty centuries later, we are stuck with 2001 being the first year of the twenty-first century.

> the first year of which was year 1 A.D. (with the year before being 1 B.C.)

Actually the troubles arising from not having a year 0 are a very good argument for arrays starting with 0. :)

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)

PS: Je suis Charlie!

oops, fixed.

Create A New User
Node Status?
node history
Node Type: note [id://774057]
help
Chatterbox?
 [oiskuu]: You want to draw the path? \$iter = combinations( \$TOP_HEIGHT .. \$NODE_HEIGHT, \$pos); then get the path from the iter, level change at depth x, for(..) \$pos += \$level_change; something like that [oiskuu]: yergh, tags... [\$top_height .. \$node_height] [Eily]: Discipulus by demonstrate I suppose you mean simulate with perl? [Eily]: the demonstration itself is fairly easy. The number of paths on a node is the sum of the numbers of paths to the two nodes above (or one node above on the edges of the triangle) [Eily]: since the value of a node is also the sum from the two nodes above, you just have to demonstrate that the equality is true at the top of the triangle [Discipulus]: yes Eily, thanks oiskuu but i dont get it.. ;=( maybe I'll ask a SOPW [LanX]: all combinations with same amount of left and right? [Eily]: if you want to store in a structure with the coordinates as key, arrays might do, since the keys are going to be 0..n [LanX]: (Pascale path)

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (9)
As of 2018-03-19 11:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
When I think of a mole I think of:

Results (239 votes). Check out past polls.

Notices?