21. Custom-Sorted Array
In an a y, elements at any two indices an
be swapped in a single operation called a
move. For example, if the array is arr = [17,
4, 8], swap arr[0] = 17 and arr[2] = 8 to get
arr' = [8, 4, 17] in a single move. Determine
the minimum number of moves required to
sort an array such that all of the even
elements are at the beginning of the array
and all of the odd elements are at the end of
the array
Answers
Answered by
3
Answer:
elements at any two indices an
be swapped in a single operation called a
move. For example, if the array is arr = [17,
4, 8], swap arr[0] = 17 and arr[2] = 8 to get
arr' = [8, 4, 17] in a single move. Determine
the minimum number of moves required to
sort an array such that all of the even
elements are at the beginning of the array
and all of the odd elements are at the end of
the array
Similar questions
Science,
1 month ago
Math,
1 month ago
Geography,
1 month ago
History,
3 months ago
Math,
3 months ago
Computer Science,
10 months ago
Social Sciences,
10 months ago