A+ Answers

In designing algorithms, we have to accomplish a certain objective. Three algorithms are given below. 

What does each algorithm accomplish when the initial values of x and y are 2 and 3, respectively? 

What are the final values for x and y for each algorithm? 

Assuming that setting up variables is more efficient than performing mathematical operations, which one is more efficient and why?

1: t1 = x; t2 = y; x = t2; y = t1

2: z = x; x = y; y = z

3: x = x + y; y = x – y; x = x – y