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
The operating cost of driving include
blagie [28]
And what is the question?
4 0
3 years ago
PLEASE HELP
kap26 [50]

Answer:

dog

Explanation:

The python program has four lists, A, B, C, and E which is a list of the first three lists. Lists are unordered indexed data structures, it is accessed by an index starting from 0 to n (which is the length of the list minus one).

The E list is a list of lists with three list items starting from index zero to two. E[0][1] is used to access the item "dog" in the first list item of the E list.

3 0
2 years ago
How does accenture generate value for clients through agile and devops?
Tomtit [17]

Through quicker time to market, better quality products, and higher customer satisfaction Agile and DevOps are key components of Accenture's value creation for clients.

Accenture plc is a Dublin-based, Irish-American professional services firm with a focus on information technology (IT) services and consulting. It was listed on the Fortune Global 500 and recorded $61.6 billion in revenue in 2022. 91 of the Fortune Global 100 and more than 75 percent of the Fortune Global 500 are among Accenture's current clients.

When General Electric wanted to install a computer at Appliance Park in Louisville, Kentucky, in the early 1950s, Accenture conducted a feasibility study for the company. This study led to GE installing a UNIVAC I computer and printer, which is thought to be the first commercial use of a computer in the United States.  A post was held by Joseph Glickauf, a pioneer in computer consulting.

To know more about Accenture click here:

brainly.com/question/24302004

#SPJ4

4 0
1 year ago
True or false? a router is a network device that directs packets over a network towards their final destination.
Alex_Xolod [135]

A router is a web device that directs packages over a web towards their final destination is true.

<h3>What is the router?</h3>
  • A router is a machine that combines two or more packet-switched grids or subnetworks.
  • A router accepts and data transmits  on computer networks. Routers are sometimes confused with network hubs, modems, or network controllers.
  • However, routers can integrate the functions of these components, and secure with these devices, to improve Internet entry or help create interaction networks.
  • A router is a device that is used for forwarding the internet connection to all the related devices.
  • A Wi-Fi connects the networking parts of a router and a wireless access point.
  • A wireless router (or Wi-Fi router) works much like a wired router, but it returns wires with wireless radio calls.

To learn more about router, refer to:

brainly.com/question/24812743

#SPJ4

7 0
1 year ago
What is a killer app??
mars1129 [50]
Application of a new technology and is much superior to rival products
6 0
3 years ago
Other questions:
  • The Windows Group Policy feature provides __________ that govern the way Windows operates in enterprise environments. a. a centr
    8·1 answer
  • Why can't you test a program for run-time errors when it has compile-time (syntax) errors
    6·1 answer
  • Meg is in the process of creating a storyboard for her personal website, but she is unable to decide which storyboarding techniq
    10·1 answer
  • Select a classification for File2 so that: Alice can read and write to File2 Bob and Charlie can write to File2, but can't read
    6·1 answer
  • Digital libraries are often available to students and/or employees at colleges, schools, and BLANK institutions.
    15·1 answer
  • Let’s say you’re publishing a message with the Hootsuite Composer. The message contains a link to a landing page, and you want t
    9·1 answer
  • Which of the following is an advantage of batch processing?
    8·1 answer
  • Julie is purchasing new shoes on a website for her favorite store. Which of the following would indicate that a website is a sec
    6·1 answer
  • When you create a new database using --------- , the database includes prebuilt tables and forms which you can populate with dat
    15·1 answer
  • Consider the following implementation of a search method:
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!