retagged by
479 views
2 votes
2 votes

The instruction $A \leq B$ changes a picture of boxes and arrows in the following way:

  • The arrow which points out of the box labeled $\mathrm{A}$ is removed.
  • Then, a new arrow out of the box labeled $A$ is added. This new arrow points to the same box as the arrow out of the box labeled $B$ points to.

For example:

What sequence of instructions (performed in order) changes the following starting picture to the following final picture?

 

  1. $X \leq Y, Y \leq Z, Z \leq X$
  2. $X \leq Z, Z \leq X, Y \leq H$
  3. $Z \leq Y, X \leq Z, Y \leq H$
  4. $Z \leq X, X \leq Y, Y \leq H$
retagged by

1 Answer

4 votes
4 votes
The first possible answer is incorrect because the original value of $\mathrm{X}$ has changed before $\mathrm{Z} \leq \mathrm{X}$ is followed. Also, the operation $\mathrm{X} \leq \mathrm{Y}$ will lose the reference to $\mathrm{Y}$ (that is, nothing will be pointing at $\mathrm{Y}$, and we cannot access or change the value of $\mathrm{Y})$. The second possible answer is incorrect because it attempts to swap $\mathrm{X}$ and $\mathrm{Z}$ without temporary storage. As in the first possible answer, we lose the reference to $Y$. The third possible answer is incorrect because it misreads $\mathrm{A} \leq \mathrm{B}$ to mean "box $A$ points to box $B.$" The fourth possible answer is correct because unlike the first possible answer, it correctly uses the "temporary value $H.$"
edited by
Answer:

Related questions

565
views
1 answers
3 votes
GO Classes asked Jan 13
565 views
In a magic square, the numbers in each row, the numbers in each column, and the numbers on each diagonal have the same sum. In the magic square shown, the value of $x$ ... \\\hline & x & \\\hline\end{array}$$3.6$3.1$2.9$2.2$