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
Write a program named Deviations.java that creates an array with the deviations from average of another array. The main() method
Westkost [7]

Answer:

hello your question is incomplete attached is the complete question and solution

answer : The solution is attached below

Explanation:

Below is a program named Derivations.java that creates an array with the deviations from average of another array.

3 0
3 years ago
Which is NOT something that a game producer needs to do?
3241004551 [841]

Answer:

Plan the script, characters, and how the game is played

6 0
3 years ago
Explain why a single 500 kg block of granite weathers much more slowly than 100 chunks of granite weighing 5 kg each.
Bad White [126]
Weathering occurs on the surface of rocks, and lots of small rocks have a much greater surface area than one big rock.
3 0
3 years ago
Read 2 more answers
Which type of software is offered in trial form or for a limited period of time?
kkurt [141]

The type of software which is offered in trial form or for a limited period of time is called shareware.

Software which are offered for free in trial form or for a limited time period are called shareware. They operate on the principle that once the user understands what the software can offer they will pay to use it later.

Most shareware software has built in countdowns which start as soon as you start the trial and at the end of which access is automatically revoked. They require the user to form a simple account. These versions generally provide a very basic selection of functions and are used to rake in more paying users.

Types of shareware include:

  1. Adware: It stands for advertising-supported software where the advertisements generate revenues.
  2. Demoware: This is a trial version of the original software including all features.
  3. Crippleware: This software is free but provides limited features till it is purchased.
  4. Trialware

This provides the user with full feature access for a time limit and then requires purchase.

You can learn more about shareware software at

brainly.com/question/4593389

#SPJ4

3 0
1 year ago
Do you think privacy policies are effective in social networking sites?
Kamila [148]

Answer:

When that information gets posted online, it is no longer private, and may end up falling into wrong hands. Even if you have put in place the highest possible security measures, some of your friends, colleagues and companies you interact with on social media, can end up leaking your personal information.

4 0
3 years ago
Other questions:
  • Which of the following would be considered a strong password?
    5·2 answers
  • What program controls the hardware and software in a computer?
    10·1 answer
  • After reading passage “the incredible machine” why do you think the article has been titled so?
    13·1 answer
  • A _____ cloud allows an organization to take advantage of the scalability and cost-effectiveness that a public cloud computing e
    5·1 answer
  • ) A popular PivotChart that is used in Access is (Points : 4) column.
    9·1 answer
  • What are two software tools for bank account reconciliation?
    8·2 answers
  • A college student needs a laptop that can be used while committing on the train and sitting in a lecture
    13·1 answer
  • I think you have been doing a great job but you haven’t been signing many people up for our new service feature I want you to se
    8·1 answer
  • Explain the characteristics of 1st generation computers​
    15·1 answer
  • What is modularity?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!