1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Andru [333]
3 years ago
7

Consider the following method: static void nPrint(String a, int n) { System.out.println(a.charAt(n)); } What potential error cou

ld this method cause? Logic Error Run time error - index out of range Compile time error - index out of range Run time error - incompatible types Compile time error - incompatible types
Computers and Technology
1 answer:
Juliette [100K]3 years ago
4 0
<span>Briefly explain why it is necessary to critique a scientific argument before it is accepted.
</span>
You might be interested in
Raj’s computer just crashed and he lost most of his files. What should he do to avoid this problem in the future?
Elanso [62]
He should back up his data regularly
3 0
4 years ago
Read 2 more answers
What devices gives input​
seraphim [82]

Answer:

keyboard and mouse is the answer

8 0
3 years ago
After pushing the power switch of the PC to the ʺonʺ position, Bob, the PC repair person, realizes that the power-on lights foun
Nana76 [90]

Answer:

<em>2. Logic</em>

<em></em>

Explanation:

We all know that for the PC to come on, there must be a power input, this means that if the PC does not power on, then there is probably no power input into the PC. <em>It is only logical for Bob to check if the PC is properly connected first when the power-on lights did not come on</em>. People with no technical training should be able to apply this simple logic too.

3 0
3 years ago
Adam is so good at playing arcade games that he will win at every game he plays. One fine day as he was walking on the street, h
klio [65]

Answer:

what the answer chaoices

Explanation:

brainlest me please

3 0
3 years ago
Assume the existence of an UNSORTED ARRAY of n characters. You are to trace the CS111Sort algorithm (as described here) to reord
makvit [3.9K]

Answer:

class Main {

  public static void main(String[] args) {

      char arr[] = {'T','E','D','R','W','B','S','V','A'};

      int n = arr.length;

      System.out.println("Selection Sort:");

      System.out.println("Iteration\tArray\tComparisons");

      long comp1 = selectionSort(arr);

      System.out.println("Total comparisons: "+comp1);

      System.out.println("\nInsertion Sort:");

      System.out.println("Iteration\tArray\tComparisons");

      long comp2 = insertionSort(arr);

      System.out.println("Total Comparisons: "+comp2);

      System.out.println("\nOverall Total Comparisons: "+(comp1+comp2));

  }

  static long selectionSort(char arr[]) {

      // applies selection sort for n/2 elements

      // returns number of comparisons

      int n = arr.length;

      long comparisons = 0;

 

      // One by one move boundary of unsorted subarray

      for (int i = n-1; i>=n-n/2; i--) {

              // Find the minimum element in unsorted array

              int max_idx = i;

              for (int j = i-1; j>=0; j--) {

                      // there is a comparison everytime this loop returns

                      comparisons++;

                      if (arr[j] > arr[max_idx])

                              max_idx = j;

              }

              // Swap the found minimum element with the first

              // element

              char temp = arr[max_idx];

              arr[max_idx] = arr[i];

              arr[i] = temp;

              System.out.print(n-1-i+"\t");

              printArray(arr);

              System.out.println("\t"+comparisons);

      }

     

      return comparisons;

  }

  static long insertionSort(char arr[]) {

      // applies insertion sort for n/2 elements

      // returns number of comparisons

      int n = arr.length;

      n = n-n/2;   // sort only the first n/2 elements

      long comparisons = 0;

      for (int i = 1; i < n; ++i) {

          char key = arr[i];

          int j = i - 1;

          /* Move elements of arr[0..i-1], that are

                  greater than key, to one position ahead

                  of their current position */

          while (j >= 0) {

              // there is a comparison everytime this loop runs

              comparisons++;

              if (arr[j] > key) {

                  arr[j + 1] = arr[j];

              } else {

                  break;

              }

              j--;

          }

          arr[j + 1] = key;

          System.out.print(i-1+"\t");

          printArray(arr);

          System.out.println("\t"+comparisons);

      }

      return comparisons;

  }  

  static void printArray(char arr[]) {

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

          System.out.print(arr[i]+" ");

  }

}

Explanation:

Explanation is in the answer.

6 0
3 years ago
Other questions:
  • How do you subscribe to Darthmaul Productions on YT?
    13·1 answer
  • On Sarah’s first day at work she is provided with a range of information technology that she can use to write , edit or create d
    5·2 answers
  • Tiny charts embedded in cells that show a visual trend alongside the data are called __________.
    10·1 answer
  • In 1988, Robert Morris, Jr. launched a program called the _________ that used weaknesses in e-mail programs and operating system
    5·1 answer
  • Which of the following statements is correct? Group of answer choices An object of type Employee can call the setProjectName met
    11·1 answer
  • Websites whose URL’s contain tildes (~) are usually published by the government. True or false?
    8·2 answers
  • . Which of the following refers to the informal rules for how to behave online? A.
    9·1 answer
  • What facilitates the automation and management of business processes and controls the movement of work through the business proc
    9·1 answer
  • A trial-and-error method of problem solving used when an algorithmic or mathematical approach is called
    7·1 answer
  • Which type of SQL Injection allows an attacker to try to alter the SQL statement such that it always returns TRUE (authenticatio
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!