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
Annette [7]
3 years ago
12

Given an unsorted array of distinct positive integers A[1..n] in the range between 1 and 10000 and an integer i in the same rang

e. Here n can be arbitrary large. You want to find out whether there are 2 elements of the array that add up to i. Give an algorithm that runs in time O(n).
Engineering
1 answer:
AnnZ [28]3 years ago
7 0

Answer:

Explanation:

Arbitrary means That no restrictions where placed on the number rather still each number is finite and has finite length. For the answer to the question--

Find(A,n,i)

for j =0 to 10000 do

frequency[j]=0

for j=1 to n do

frequency[A[j]]= frequency[A[j]]+1

for j =1 to n do

if i>=A[j] then

if (i-A[j])!=A[j] and frequency[i-A[j]]>0 then

return true

else if (i-A[j])==A[j] and frequency[j-A[j]]>1 then

return true

else

if (A[j]-i)!=A[j] and frequency[A[j]-i]>0 then

return true

else if (A[j]-i)==A[j] and frequency[A[j]-i]>1 then

return true

return false

You might be interested in
The capacity of a battery is 1800 mAh and its OCV is 3.9 V. a) Two batteries are placed in series. What is the combined battery
Lynna [10]

Answer:

capacity  = 0.555 mAh

capacity  = 3600 mAh

Explanation:

given data

battery = 1800 mAh

OCV = 3.9 V

solution

we get here capacity when it is in series

so here Q = 2C  

capacity  = 2 × ampere × second   ...............1

put here value and we get

and 1 Ah = 3600 C

capacity  = \frac{2}{3600}

capacity  = 0.555 mAh

and

when it is in parallel than capacity will be

capacity = Q1 +Q2   ...............2

capacity  = 1800 + 1800

capacity  = 3600 mAh

3 0
3 years ago
A 1 turn coil carries has a radius of 9.8 cm and a magnetic moment of 6.2 X 10 -2 Am 2. What is the current through the coil?
Alexus [3.1K]

Answer:

The current through the coil is 2.05 A

Explanation:

Given;

number of turns of the coil, N = 1

radius of the coil, r = 9.8 cm = 0.098 m

magnetic moment of the coil, P = 6.2 x 10⁻² A m²

The magnetic moment is given by;

P = IA

Where;

I is the current through the coil

A is area of the coil = πr² = π(0.098)² = 0.03018 m²

The current through the coil is given by;

I = P / A

I = (6.2 x 10⁻² ) / (0.03018)

I = 2.05 A

Therefore, the current through the coil is 2.05 A

6 0
3 years ago
Learning the key concepts of each approach is essential to successful management of a project. What type of unpredictability is
Levart [38]

Answer:

lemme write it down

Explanation:

hold down okay

3 0
3 years ago
The best grade of hardwood lumber that is generally available is _____​
Vesnalui [34]

Answer:

FAS

Explanation:

first and second grade

5 0
2 years ago
Why were the French and Dutch colonized areas so small compared to the Spanish colonized areas?
Degger [83]
The French and Dutch colonized arenas so small compared to the Spanish colonized areas For farming
4 0
3 years ago
Read 2 more answers
Other questions:
  • Which solution causes cells to shrink
    13·1 answer
  • Select the correct answer.
    7·1 answer
  • Que es resistencia ?
    15·1 answer
  • The air loss rate for a straight truck or bus with the engine off and the brakes
    11·1 answer
  • You rent an apartment that costs $1800 per month during the first year, but the rent is set to go up 11,5% per year. What would
    12·1 answer
  • Stakeholders are people or organizations who do what?
    10·2 answers
  • Please what is dif<br>ference between building technology and building engineering.​
    14·2 answers
  • X+3=2<br>x=??<br><br><br><br>No spamming​
    11·1 answer
  • The reversible and adiabatic process of a substance in a compressor begins with enthalpy equal to 1,350 kJ/kg, and ends with ent
    15·1 answer
  • Its been days wsgggggg
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!