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
Irina-Kira [14]
3 years ago
5

Give a pseudo-code description of the O(n)-time algorithm for computing the power function p(x,n).Also draw the trace of computi

ng p(3,3)using this algorithm?
Computers and Technology
1 answer:
laila [671]3 years ago
6 0

Answer:

p(x,n)

1. if(n==0)    [if power is 0]

2.    then result =1.

3.else

4. {    result=1.

5.      for i=1 to n.

6.          {  result = result * x. }  [each time we multiply x once]

7.       return result.

8.  }

Let's count p(3,3)

3\neq0, so come to else part.

i=1: result = result *3 = 3

i=2: result = result *3 = 9

i=2: result = result *3 = 27

Explanation:

here the for loop at step 4 takes O(n) time and other steps take constant time. So overall time complexity = O(n)

You might be interested in
If I Uninstall Nba 2k 19 from my ps4 will my career be gone forever?​
Rudik [331]

Answer:

Not unless you have a ps plus membership

Explanation:

Ps plus have cloud storage so if you have ps plus membership,even if you delete 2k19 your data will be saved in the cloud storage therefore your my carrer will not be gone forever!

7 0
3 years ago
Read 2 more answers
A Lost link is an interruption or loss of the control link between the control station and the unmanned aircraft, preventing con
Vlad [161]

Answer:

There is nothing to answer from this statement.

Explanation:

Can you rephrase the statement into question?

4 0
3 years ago
what is the molarity of a solution prepared by dissolving 15.0g of sodium hydroxide in enough water to make a total of 225 ml of
Reptile [31]

Answer:

1.6666 g/mol = 1 \frac{2}{3} g/mol

Explanation:

Molar mass of NaOH= 23+16+1 =40g/mol

Mols in 15g = 15/40 mol

If this was dissolved in 225ml of water molarity of the solution is

\frac{15}{40} ÷ 225 x 1000 = 1.6666 g/mol = 1 \frac{2}{3} g/mol

5 0
3 years ago
PLEASE I NEED HELP PLEASE PLEASE<br> Which function prompts the user to enter information?
Stels [109]

In python the input() function prompts the user to enter information.

5 0
2 years ago
What is a sound wave
solmaris [256]

Answer:

A wave of sound!

Explanation:

sound waves are sound but sound comes in different wavelengths

7 0
3 years ago
Read 2 more answers
Other questions:
  • After you enter the details for the first selected recipient in the New Address List dialog box, click _______ to add another re
    11·2 answers
  • CNG and gasoline-powered vehicles use the same internal combustion engine, but different fuel types. A) True B) False
    8·2 answers
  • Which represents the hierarchical structure of a Google Analytics account from top to bottom?
    5·1 answer
  • Two machines can finish a job in StartFraction 20 Over 9 EndFraction hours. Working​ alone, one machine would take one hour long
    10·1 answer
  • 1. Build and test D-type Flip-Flop using a built-in SR flip-flop.
    12·1 answer
  • PLZZZ HELP!!! I’ll give brainliest
    12·1 answer
  • Whose job is it to ensure that a group stays focused and on schedule?
    8·1 answer
  • Se numeşte permutare a unei mulţimi finite orice rearanjare a tuturor elementelor acelei mulţimi.
    14·1 answer
  • after entering backstage view, and clicking account settings, what are the steps for creating a delegate for an outlook folder
    6·1 answer
  • Explain the different type of shift register counter ​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!