Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please use merge sort to sort the array L ascendingly and decreasingly , output the final result. (Sort and reverse sort the given input array
Please use merge sort to sort the array L ascendingly and decreasingly , output the final result. (Sort and reverse sort the given input array using merge sort)
import java.util.*;
public class Solution {
public int[][] sort(int[] list) {
int arr[][] = {{1,2},{3,4}};
return arr;
}
}
Example 1: Input: L = 12, 11, 13, 6,5; Output: [[5, 6, 11, 12, 13],[13, 12, 11, 6, 5]] Example 2: Input: L = 432,432,21,2,31,25,61 Output: [[2, 21, 25, 31, 61, 432, 432], [432, 432, 61, 31, 25, 21, 2]] Example 3: Input: L = 250, 343, 137, 789, 551, 954; Output: [[137, 250, 343, 551, 789, 954], [954, 789, 551, 343, 250, 137]] Example 4: Input: L = 61,61,21,2,61,25,61 Output: [[2, 21, 25, 61, 61, 61, 61], [61, 61, 61, 61, 25, 21, 2]]Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started