## Invitation to Computer Science 8th Edition

Let's store the elements in reversed order in the sequence: $R_{1}, R_{2}, \ldots R_{k}$ After that, let's copy the already reversed list back into $N_{1}, N_{2}, \ldots N_{k}$ $\bullet$ Get the value of $k$ $\bullet$ Get the elements of the list $N_{1}, N_{2}, \ldots N_{k}$ $\bullet$ Set the value of $i$ to 1 $\bullet$ While $(i \leq k)$ do $\bullet \quad$ Set value of $R_{i}$ to $N_{k+1-i}$ $\bullet\quad$ Increment $i$ by 1 $\bullet$ End of loop $\bullet$ Set value of $i$ to 1 $\bullet$ While $(i \leq k)$ do $\bullet \quad$ Set value of $N_{i}$ to $R_{i}$ $\bullet\quad$ Increment $i$ by 1 $\bullet$ End of loop $\bullet$ Print the result: $N_{1}, N_{2}, \ldots N_{k}$
Let's store the elements in reversed order in the sequence: $R_{1}, R_{2}, \ldots R_{k}$ After that, let's copy the already reversed list back into $N_{1}, N_{2}, \ldots N_{k}$ $\bullet$ Get the value of $k$ $\bullet$ Get the elements of the list $N_{1}, N_{2}, \ldots N_{k}$ $\bullet$ Set the value of $i$ to 1 $\bullet$ While $(i \leq k)$ do $\bullet \quad$ Set value of $R_{i}$ to $N_{k+1-i}$ $\bullet\quad$ Increment $i$ by 1 $\bullet$ End of loop $\bullet$ Set value of $i$ to 1 $\bullet$ While $(i \leq k)$ do $\bullet \quad$ Set value of $N_{i}$ to $R_{i}$ $\bullet\quad$ Increment $i$ by 1 $\bullet$ End of loop $\bullet$ Print the result: $N_{1}, N_{2}, \ldots N_{k}$