## Invitation to Computer Science 8th Edition

Published by Cengage Learning

# Chapter 2 - Exercises - Page 88: 25

#### Answer

$\bullet$ Set value of Previous to 0 $\bullet$ Set value of $V$ to the first element of the list $\bullet$ Set the value of Exists to $N O$ $\bullet$ While both $(V \geq-1)$ and (Exists $=N O )$ do $\bullet \quad$ Set value of Previous to $V$ $\bullet \quad$ Set value of $V$ to next element from the list $\bullet\quad$ If Previous $=V$ then $\bullet\quad\quad$ Set Exists to $Y E S$ $\bullet$ End of loop. $\bullet$ Print value of Exists

#### Work Step by Step

$\bullet$ Set value of Previous to 0 $\bullet$ Set value of $V$ to the first element of the list $\bullet$ Set the value of Exists to $N O$ $\bullet$ While both $(V \geq-1)$ and (Exists $=N O )$ do $\bullet \quad$ Set value of Previous to $V$ $\bullet \quad$ Set value of $V$ to next element from the list $\bullet\quad$ If Previous $=V$ then $\bullet\quad\quad$ Set Exists to $Y E S$ $\bullet$ End of loop. $\bullet$ Print value of Exists

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.