question archive Suppose you want to interchange the values stored in memory cells 2 and3
Subject:Computer SciencePrice:2.89 Bought3
Suppose you want to interchange the values stored in memory cells 2 and3. What is wrong with the following sequence of steps:
Step 1. Move the contents of cell number 2 to cell number 3.
Step 2. Move the contents of cell number 3 to cell number 2.
Design a sequence of steps that correctly interchanges the contents of these cells. If needed, you may use additional cells.
The problem with this is the values in both memory cells would not be able to interchange according to the given steps because when content of cell 2 is moved to cell 3. The initial value of cell 3 would be replaced by the content of cell 2, so in step 2 the same content would be moved in cell 2 which is already placed in cell 2. So Interchanging not be possible in this way.
In order to interchange 2 cell contents we can use another temporary cell (cell number 4) and these steps should be followed in order to get best results.