# Given a vector/array with values 5, 10, 15, 20, 25, what are the fewest number of swaps needed to reverse the list?

Question

Given a vector/array with values 5, 10, 15, 20, 25, what are the fewest number of swaps needed to reverse the list?

in progress 0
1 month 2022-12-24T08:23:25+00:00 1 Answer 0 views 0

1. The fewest number of swaps needed to reverse the list is  2
This is further explained below.

### What is an array?

Generally,  In the field of computer science, a data structure known as an array sometimes referred to simply as an array, is one that is composed of a collection of items, each of which is distinguished by at least one array index or key. An array is saved in such a way that a mathematical formula may use the index tuple of each element to determine the location of that element within the array.
Given an array with values 5, 10, 15, 20, 25
Swaps did reverse the array are
• 25, 10, 15, 20, 5
• 25, 20, 15, 10, 5
Therefore, the number of swaps necessary to invert the list is two. This is the smallest possible number.
In conclusion,  Two exchanges are the bare minimum required to accomplish the list’s reversal.