Course Solutions Uncategorized (Solved) : Know Answrs Show Steps Getting Answers M Getting Stuck Tracing Public Class Twoa Public St Q29488493 . . . .

(Solved) : Know Answrs Show Steps Getting Answers M Getting Stuck Tracing Public Class Twoa Public St Q29488493 . . . .

 

I know the answrs, but can you show the steps getting theanswers. i’m getting stuck on some of the tracing

public class TwoA {

    public static void main(String[] args) {

        final int SIZE =5;

        int [] x = {19, 43,22, -1};

        for (int i=0;i<x.length; i++) {

           int currentMin = x[i];

           int minIndex = i;

           for (int j=i+1; j < x.length; j++) {

               if (x[j] < currentMin) {

                   currentMin = x[j];

                   minIndex = j;

                   System.out.println(“Min: ” + j + ” ” + currentMin);

               }

           }

           if (minIndex != i) {

               x[minIndex] = x[i];

               x[i] = currentMin;

               System.out.println(“Swapped: ” + x[i] + ” ” + x[minIndex]);

           }

        }

    }

}

ANS:

Min: 3 -1

Swapped: 19 -1

Min: 2 22

Min: 3 19

Swapped:

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post