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]
4 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]4 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 cold drawn AISI 1040 steel bar with 25-mm width and 10-mm thick has a 6- mm diameter thru hole in the center of the plate. T
4vir4ik [10]

Answer:

A)  ( N ) = 1.54

B)  N ( Goodman ) = 1.133,  N ( Morrow) = 1.35

Explanation:

width of steel bar = 25-mm

thickness of steel bar = 10-mm

diameter = 6-mm

load on plate = between 12 kN AND 28 kN

notch sensitivity = 0.83

A ) Fatigue factor of safety based on yielding criteria

= δa + δm = \frac{Syt}{n}   =  91.03 + 227.58 = 490 / N

therefore Fatigue number of safety ( N ) = 1.54

δa (amplitude stress ) = kf ( Fa/A) = 2.162 * ( 8*10^3 / 190 ) = 91.03 MPa

A = area of steel bar = 190 mm^2 , Fa = amplitude load = 8 KN , kf = 2.162

δm (mean stress ) = kf ( Fm/A ) = (2.162 * 20*10^3 )/ 190 = 227.58 MPa

Fm = mean load  = 20 *10^3

B) Fatigue factor of safety based on Goodman and Morrow criteria

δa / Se + δm / Sut = 1 / N

= 91.03 / 183.15 + 227.58 / 590 = 1 /N

Hence N = 1.133 ( based on Goodman criteria )

note : Se = endurance limit (calculated) = 183.15 , Sut = 590

applying Morrow criteria

N =   1 / ( δa/Se) + (δm/ δf )

   = 1 / ( 91.03 / 183.15 ) + (227.58 / 935 )  

   = 1.35

6 0
4 years ago
3. What is a caliber (relate it to rockets)
Kamila [148]

Answer:

In this context a caliber is defined as the diameter of the body tube, and it is used to support the general rule of thumb that for a rocket of typical aspect ratio to be stable the CG should be one caliber ahead of CP.

Explanation:

6 0
3 years ago
How is an orthographic drawing similar to or different from an isometric drawing?
evablogger [386]
An isometrical drawing is a nearly 3d drawing showing the object's width and depth in a complete image, from each curved plane of the orthhographic view, the viewpoint is at a 45 degree angle. From an observations point of view, isometric differs, since all longitudes are true.
4 0
3 years ago
Read 2 more answers
Water enters a centrifugal pump axially at atmospheric pressure at a rate of 0.12 m3
goldenfox [79]

Answer:

Water enters a centrifugal pump axially at atmospheric pressure at a rate of 0.12 m3/s and at a velocity of 7 m/s, and leaves in the normal direction along the pump casing, as shown in Fig. PI3-39. Determine the force acting on the shaft (which is also the force acting on the bearing of the shaft) in the axial direction.

Step-by-step solution:

Step 1 of 5

Given data:-

The velocity of water is .

The water flow rate is.

3 0
3 years ago
Convert 250 lb·ft to N.m. Express your answer using three significant figures.
vfiekz [6]

Answer:

It will be equivalent to 338.95 N-m

Explanation:

We have to convert 250 lb-ft to N-m

We know that 1 lb = 4.45 N

So foe converting from lb to N we have to multiply with 4.45

So 250 lb = 250×4.45 =125 N

And we know that 1 feet = 0.3048 meter

Now we have to convert 250 lb-ft to N-m

So 250lb-ft=250\times 4.45N\times 0.348M=338.95N-m

So 250 lb-ft = 338.95 N-m

6 0
3 years ago
Other questions:
  • a vehicle is in her repair with a complaint at for heating output during testing and diagnosing air is found to be trapped in th
    15·1 answer
  • If you are in a tornado situation, which of the following actions would put you in danger?
    11·1 answer
  • the voltage across a 5mH inductor is 5[1-exp(-0.5t)]V. Calculate the current through the inductor and the energy stored in the i
    6·1 answer
  • Which of the following is not a function of the suspension system?_____
    6·1 answer
  • For an AC machine, what percentage of power is at the negative terminal?
    14·1 answer
  • Di hola por 10 puntos
    8·1 answer
  • The two major forces opposing the motion of a vehicle moving on a level road are the rolling resistance of the tires, Fr, and th
    7·1 answer
  • What is the purpose for this experiment
    9·1 answer
  • How do we infer that there is
    9·1 answer
  • Outline how effective brainstorming should be set up so that it does not go off-track or alienate anyone.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!