Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In java I am trying to find the second smallest and second largest number in a 2d array. int array[][] = {{1,2.3},{3,4,5,},{6,7,8}}; int n =
In java I am trying to find the second smallest and second largest number in a 2d array.
int array[][] = {{1,2.3},{3,4,5,},{6,7,8}};
int n = array.length;
for (int i = 0; i < n; i++) {
for(int j = 0; j < n; j++) {
if(array[i] < [j]) }
int temp = array[i];
array[i] = array[j];
array[j] = temp;
}
}
}
System.out.print(array[1]);
system.out.print(array[n-2]);
However I get an error and I am not sure how to fix it.
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