Write a method called switchPairs that switches the order of values in the list in a pairwise fashion. Your method should switch the order of the first two values, then switch the order of the next...



Write a method called switchPairs that switches the order of values in


the list in a pairwise fashion. Your method should switch the order of


the first two values, then switch the order of the next two, switch the


order of the next two, and so on. If the list contains an odd number of


values, the final element is not moved. For example, if the list initially


stores [10, 25, 31, 47, 52, 68, 77], your method should switch the


first pair (10 and 25), the second pair (31 and 47), and the third pair (52


and 68) to yield [25, 10, 47, 31, 68, 52, 77].



May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here