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
What is SEO and SEM?
velikii [3]

Answer:

SEO stands for “search engine optimization.” In simple terms, it means the process of improving your site to increase its visibility for relevant searches.

SEM, or search engine marketing, is the act of using paid strategies to increase search visibility.

4 0
2 years ago
Which of the following describes a Trojan horse?
HACTEHA [7]

Answer:

the answer is

c. Trojan horses enter a secure space, while an infected file proceeds to be downloaded and run.

7 0
3 years ago
The “Fix a Problem” section of About.com’s PC support page provides information on Reversing Damages and (blank) plss help its t
Lera25 [3.4K]

Answer:

Mistakes

Explanation:

What are the three main technical support options for Microsoft users. Find It Myself, Ask the Community, <u>The "Fix a Problem" section of About.com's PC support page provides information on Reversing Damages and </u><u>MISTAKES.</u>

4 0
3 years ago
Read 2 more answers
Who does car shows in gta 5 or what do you guys do in gta
grandymaker [24]

Answer:

google can find u some discord servers

Explanation:

4 0
3 years ago
Read 2 more answers
When you use a mouse to select a row or column in a table, word displays a(n) ____?
Harrizon [31]
Insert Control, I believe.
5 0
3 years ago
Other questions:
  • Which of the following best explains why some people invest their saving in the stock market and others put their saving in bank
    5·2 answers
  • One random part of Chess is whether the white side or the black side moves first? A. True B. False
    10·2 answers
  • Define the following terms:<br><br> - pigment<br> - vehicle<br> - binder<br><br> plz help
    12·2 answers
  • What computer is designed to meet the computing needs of several people simultaneously in a small to medium-size business enviro
    5·1 answer
  • The two major types of system software programs are utility programs and the ________. Select one: A. user interface B. supervis
    13·1 answer
  • Neymar machine that Run on electricity
    11·1 answer
  • You are configuring a firewall to use NAT. In the configuration, you map a private IP address directly to a persistent public IP
    9·1 answer
  • Write a program that represents a popular kid’s toy that teaches them about different shapes and colors.
    14·1 answer
  • Can someone help me get spotify premium
    7·2 answers
  • How can you make a search phrase more effective?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!