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
lukranit [14]
3 years ago
8

Please check my answer! (Java)

Computers and Technology
1 answer:
Nat2105 [25]3 years ago
8 0

9 is the correct answer. 4*2=8 loops are executed, moving the count from 1 to 9.

You might be interested in
What describes Accenture's approach to automation?
kogti [31]

human center because we describe stuff by what we see and obserevs

4 0
3 years ago
Read 2 more answers
The ArrayList class contains a trim method that resizes the internal array to exactly the capacity. The trim method is intended
andreev551 [17]

Answer:

public void trimToSize() {

modCount++;

if (size < elementData.length) {

elementData = (size == 0)

? EMPTY_ELEMENTDATA

: Arrays.copyOf(elementData, size);

}

}

Now, the running time for copyOf() function is O(N) where N is the size/capacity of the ArrayList. Hence, the time complexity of trimToSize() function is O(N).

Hence, the running time of building an N-item ArrayList is O(N^2).

Please find the sample code below.

CODE

==================

import java.util.ArrayList;

public class Driver {

  public static void main(String[] args) throws Exception{

      int N = 100000;

      ArrayList<Integer> arr = new ArrayList<>(N);

     

      long startTime = System.currentTimeMillis();

      for(int i=0; i<N; i++) {

          arr.add(i);

          arr.trimToSize();

      }

      long endTime = System.currentTimeMillis();

      double time = (endTime - startTime)/1000;

      System.out.println("Total time taken = " + time + " seconds.");

  }

}

Explanation:

5 0
4 years ago
20 points<br><br> In what ways is the human brain like a computer? In what ways is it different?
mojhsa [17]

Answer:

Alright imma explain below

Explanation:

It it’s similar because both give info. Also the reaction time on both are fast. They are different in some ways too. A computer runs on electricity but the brain doesn’t. A brain can actually think but a computer can not.

Hope this helps

8 0
3 years ago
Read 2 more answers
Shapes in the Shapes gallery can be combined to show relationships among the elements.
LUCKY_DIMON [66]
Yes, this statement is true.
Actually this statement is about using Microsoft PowerPoint, shapes in the shape gallery can be combined to show relationships among the elements.
In the shape gallery of Microsoft PowerPoint, there are many shapes such as oval, square, rectangle, star, line and many more. One can use any shape to illustrate the concept or to show relationship between something.
8 0
3 years ago
Performance testing is only important for real-time or embedded systems. <br> A) TRUE<br> B) FALSE
blagie [28]
The answer is B) False
8 0
4 years ago
Other questions:
  • A friend complains that she is always running out of money even though she “never buys anything expensive.” What advice would yo
    10·1 answer
  • Which of the following terms best describes the security domain that relates to how data is classified and valued?
    14·1 answer
  • Maria is comparing her history project's second-place award to her classmate's first-place award. She starts planning how to win
    9·2 answers
  • g A sign of thrashing is Group of answer choices the CPU utilization increases as the degree of multiprogramming is increased. t
    5·1 answer
  • Hello. I have an app which doesn't let me get in. It says: "wrong app info". I'm in a samsung device. How can I solve that probl
    13·2 answers
  • What's the difference between cross-site scripting and cross-site request forgery? How do you protect against cross-site request
    15·1 answer
  • (03.05 LC
    14·1 answer
  • Only for study<br><br>Or open Meet and enter this code: bqa-ivfs-ach​
    11·2 answers
  • Examples of pop in computer​
    14·1 answer
  • Basic computer programs used by a variety of companies include:
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!