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
Grace [21]
3 years ago
15

Give a big-Oh characterization, in terms of n, of the running time of the Ex1-EX5 functions as shown in following Code Fragment

..
Algorithm
Ex1 ( A):
Input:
An array A storing n?1 integers.

Output:
The sum of the elements in A.
s? A[0]
for i?1 to n?1 do
s?s+ A[i]
return s

Algorithm
Ex2( A):
Input: An array A storing n?1 integers.
Output:
The sum of the elements at even cells in A.
s? A[0]
for i ?2 to n?1 by increments of 2 do
s?s+ A[i]
return s

Algorithm
Ex3 ( A):
Input: An array A storing n?1 integers.
Output:
The sum of the pre?x sums in A.
s?0
for i?0 to n?1 do
s?s+ A[0]
for j?1 to i do
s?s+ A[ j]
return s

Algorithm
Ex4( A):
Input:An array A storing n?1 integers.
Output:
The sum of the pre?x sums in A.
s? A[0]t ?s
for i?1 to n?1 do
s?s+ A[i]
t ?t +s
return t

Algorithm
Ex5 ( A, B):
Input:Arrays A and B each storing n?1 integers.
Output:
The number of elements in B equal to the sum of pre?x sums in A.
c?0
for i?0 to n?1 do
s ?0
for j?0 to n?1 do
s?s+ A[0]
for k ?1 to j do
s?s+ A[k ]
if B[i] =s then c?c+1
return c

Engineering
1 answer:
mash [69]3 years ago
8 0

Answer:

Hello there, Please follow the step by step explanations for answer.

Explanation:

Hello there, Please follow the step by step explanations for answer.

Ex1 ( A):

it depends on n

=> O(n)

2.)

O(n/2) which is equal to O(n)

3.)O(n^2)

4.)O(2n) ==> O(n)

5.)O(n^3)

Also, see file attachment on this question for more clarity. Thanks and all the best.

You might be interested in
How do you solve this. I dont know how so I need steps if you dont mind
galben [10]

Explanation:

all I know is every number that have a bar on is equal to one

4 0
3 years ago
1. A thin-walled cylindrical pressure vessel is capped at the end and is subjected to an internal pressure (p). The inside diame
Vesna [10]
I DONT KNOW OKAY UGHHH
6 0
3 years ago
What is the resultant force on one side of a 25cm diameter circular plate standing at the bottom of 3m of pool water?
Tom [10]

Answer:

F=1.47 KN

Explanation:

Given that

Diameter of plate = 25 cm

Height of pool h = 3 m

We know that force can be given as

F= P x A

P=ρ x g x h

Now by putting the values

P=1000 x 10 x 3

P= 30 KPa

A=\dfrac{\pi}{4}\times 0.25^2\ m^2

A=0.049\ m^2

F= 30 x 0.049 KN

F=1.47 KN

So the force on the plate will be 1.47 KN.

4 0
3 years ago
What are the main differences between pipefitters and plumbers? (Select all that apply.)
romanna [79]

Answer:

pipefitters design systems whereas plumbers maintain systems

8 0
3 years ago
Three identical fatigue specimens (denoted A, B, and C) are fabricated from a nonferrous alloy. Each is subjected to one of the
Law Incorporation [45]

Answer:

B A and C

Explanation:

Given:

Specimen         σ_{max}                      σ_{min}

A                       +450                      -150

B                       +300                      -300

C                       +500                      -200

Solution:

Compute the mean stress

σ_{m} =  (σ_{max}  +  σ_{min})/2

σ_{mA} =  (450 + (-150)) / 2

       =  (450 - 150) / 2  

       = 300/2

σ_{mA} = 150 MPa

σ_{mB}  = (300 + (-300))/2

        = (300 - 300) / 2

        = 0/2  

σ_{mB}  = 0 MPa

 

σ_{mC}  = (500 + (-200))/2

        = (500 - 200) / 2

        = 300/2

σ_{mC}  = 150 MPa  

Compute stress amplitude:

σ_{a} =  (σ_{max}  -  σ_{min})/2    

σ_{aA} =  (450 - (-150)) / 2

       =  (450 + 150) / 2

       = 600/2

σ_{aA} = 300 MPa

σ_{aB} =  (300- (-300)) / 2

       =  (300 + 300) / 2

       = 600/2

σ_{aB}  = 300 MPa

σ_{aC}  = (500 - (-200))/2

        = (500 + 200) / 2

        = 700 / 2

σ_{aC}   = 350 MPa

From the above results it is concluded that the longest  fatigue lifetime is of specimen B because it has the minimum mean stress.

Next, the specimen A has the fatigue lifetime which is shorter than B but longer than specimen C.

In the last comes specimen C which has the shortest fatigue lifetime because it has the higher mean stress and highest stress amplitude.

7 0
4 years ago
Other questions:
  • An inflatable structure has the shape of a half-circular cylinder with hemispherical ends. The structure has a radius of 40 ft w
    6·1 answer
  • Air is compressed in the compressor of a turbojet engine. Air enters the compressor at 270 K and 58 kPa and exits the compressor
    13·1 answer
  • Compared to arc welding, which of the following statements are true about<br> gas welding?
    13·1 answer
  • A circular ceramic plate that can be modeled as a blackbody is being heated by an electrical heater. The plate is 30 cm in diame
    15·1 answer
  • 1. True or False: When two batteries are wired in Series the Volts go up and the Amp Hours stay the same. 2. True or False: When
    6·1 answer
  • The benefit of using the generalized enthalpy departure chart prepared by using PR and TR as the parameters instead of P and T i
    6·1 answer
  • In terms of the atomic radius, R, determine the distance between the centers of adjacent atoms for the FCC crystal structure alo
    15·1 answer
  • A 0.9% solution of NaCl is considered isotonic to mammalian cells. what molar concentration is this?
    10·1 answer
  • By using order of magnitude analysis, the continuity and Navier-Stokes equations can be simplified to the Prandtl boundary-layer
    9·1 answer
  • If my current directory is ‘AR’ write the path for my current directory
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!