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
AnnyKZ [126]
1 year ago
10

which one of the following will reach every element in the array a? 1. for(int i = 0; i <= a.length; i++) 2. for(int i = 0; i

< a.length; i++) 3. for(int i = 1; i <= a.length; i++) 4. for(int i= 1-1 ; i < a.length; i++)
Computers and Technology
1 answer:
andrey2020 [161]1 year ago
4 0

Answer:

You can simplify the problem down by recognizing that you just need to keep track of the integers you've seen in array that your given. You also need to account for edge cases for when the array is empty or the value you get would be greater than your max allowed value. Finally, you need to ensure O(n) complexity, you can't keep looping for every value you come across. This is where the boolean array comes in handy. See below -

public static int solution(int[] A)

{

int min = 1;

int max = 100000;

boolean[] vals = new boolean[max+1];

if(A.length == 0)

return min;

//mark the vals array with the integers we have seen in the A[]

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

{

if(A[i] < max + 1)

vals[A[i]] = true;

}

//start at our min val and loop until we come across a value we have not seen in A[]

for (int i = 1; i < max; i++)

{

if(vals[i] && min == i)

min++;

else if(!vals[i])

break;

}

if(min > max)

return max;

return min;

}

You might be interested in
Jenae helps maintain her school web site and needs to create a web site poll for students. Which tool will she use? JavaScript H
irga5000 [103]

Answer:

Text Editor

Explanation:

What the question implies is that, what tool will she need to create the website.

And the answer is a text editor; this is so because the other three options are web development languages used in developing a website but the text editor is where she'll write her line of codes to create the required website poll.

Example of usable text editors are notepad and notepad++ etc.

4 0
3 years ago
Read 2 more answers
1. Which markup language adds the ability to use video without requiring the user to download add-ons?
aniked [119]

HTML5

HTML5 has fewer plug-ins like the ability to standardize how audio and video are presented on a Web page. It introduces the <video> element designed to remove the need to install 3rd party add-ons and plug-ins like adobe flash player. It also adds the <audio> element  too that allows pages to smoothly add audio files.

3 0
3 years ago
in order to switch from paper to digital medical records the hospital bought in several individuals to introduce and implement t
VladimirAG [237]

Available options are:

A. Technical champions

B. Engaged filmmakers

C. Business partners

D. Compliance champions

Answer:

Technical champions

Explanation:

Given that a "Technical Champion" is someone whose responsibility is to introduce and perform the role of enabling the use of technology, development of skills across the organization, and strengthen communication between Information Technology and the staff or employees.

Hence, in this case, considering the job descriptions described in the question above, these individuals would best be described as TECHNICAL CHAMPIONS

6 0
2 years ago
Which keys can be pressed to change the cuboid/frame selector color on remotasks lidar course
Dmitry_Shevchenko [17]

Answer:

c h b l

color palette and a lightbulb

5 0
3 years ago
To use AutoSum with a row of four values, where must your cursor be to have the sum appear in the row if you have not highlighte
yan [13]

Answer:

on the first empty cell to the right of the last cell containing a value.

Explanation:

The AutoSum function in excel gives a shortcut path to taking the sum of numeric values in a row or column of data. The Autosum uses the sum function to take the addition of all the desired rows or columns values without needing to make a manual highlight of the data. To use AutoSum with a row of 4 values, the cursor must be placed immediately at the cell next 4th row cell containing a value. This is equivalent to the first empty cell to the right of the last cell containing a value, then autosum is clicked in the home tab and all 4 cells will be highlighted as it uses the sum function to calculate the sun of the 4 row values.

5 0
2 years ago
Other questions:
  • Can your digital footprint be destroyed or does it remain active on the internet forever
    5·1 answer
  • Can you combine a wireless and wired lan in the same home
    14·1 answer
  • An organization is concerned with the amount of sensor data that is being generated locally, analyzed in the cloud, and returned
    6·1 answer
  • Why are the social and ethical consequences of emerging technology hard to
    10·1 answer
  • Write a program that reads a string of characters, pushing each character onto a stack as it is read and simultaneously adding i
    5·1 answer
  • For enterprise servers, or servers accessed around the clock, SATA disks are preferred over SAS disks. True or False
    12·1 answer
  • Copyright laws protect:This task contains the radio buttons and checkboxes for options. The shortcut keys to perform this task a
    6·1 answer
  • PLEASE HELP!! Computer science test
    11·1 answer
  • A_______ to show the working of an object before it is built or made. A. Prototype b. Test c. Evaluation d. Plan
    10·1 answer
  • Owen is writing a program that will lock his computer for one hour if the incorrect password is entered more than five times. Ha
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!