I have seen a problem set for the tower of hanoi algorithm that states:
Each integer in the second line is in the range 1 to K where the i-th integer denotes the peg to which disc of radius i is present in the initial configuration.
What does i-th actually mean? If i have a line conforming to the format above such as:
4 2 4 3 1 1
How exactly does this translate to the format described above?
$\endgroup$ 13 Answers
$\begingroup$The statement that
the $i$-th integer denotes the peg on which the disk of radius $i$ is present in the initial configuration
is shorthand for this statement:
the first integer in the list is the number of the peg on which the disk of radius $1$ is initially placed; the second integer in the list is the number of the peg on which the disk of radius $2$ is initially placed; the third integer in the list is the number of the peg on which the disk of radius $3$ is initially placed; and so on, until the $K$-th and last integer in the list is the number of the peg on which the disk of radius $K$ is initially placed.
The list $4,2,4,3,1,1$ indicates that the disk of radius $1$ starts on peg $4$, the disk of radius $2$ starts on peg $2$, the disk of radius $3$ starts on peg $4$, the disk of radius $4$ starts on peg $3$, and the disks of radius $5$ and $6$ start on peg $1$. The configuration is therefore this one, where the numbers in the array are the radii of the disks.
$$\begin{array}{cc} \text{Peg }1&\text{Peg }2&\text{Peg }3&\text{Peg }4\\ \hline 5&&&1\\ 6&2&4&3 \end{array}$$
$\endgroup$ $\begingroup$When we say "the $i$-th" it means that we have some collection of objects (in your case integers) that are indexed by naturals (so that for each object one natural number is given) and so the $i$-th is the generic object of the collection whose index (the natural used to label it) is just $i$.
So for instance, suppose we have your collection of integers $4,2,4,3,1,1$ we can label then so that each of them has a "name", we can make this by setting:
$$a_1=4 \quad a_2=2 \quad a_3=4 \quad a_4=3 \quad a_5=1\quad a_6=1$$
Then the $i$-th one is the generic $a_i$ where $i$ is some number between your labels which in this case are $1,2,3,4,5,6$.
$\endgroup$ 0 $\begingroup$The letter $i$ is being used as a placeholder for a natural number. So for instance the $i$-th element in the following sequence $a$ is $2^i$ $$a=(2,4,8,16,32,64,\ldots).$$
For $i=1$ we have the 1st element is $2^1=2$.
For $i=2$ we have the 2nd element is $2^2=4$.
etc
$\endgroup$