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]
4 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]4 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 that grades the written portion of the driver's license exam. The exam has 20 multiple choice questions (answers
Roman55 [17]

Answer:

B

Explanation:

I guess

4 0
3 years ago
When users talk about font size,
koban [17]

Answer:

The answer is 10......

4 0
3 years ago
Read 2 more answers
Which of the following allows you to view and access important information about your document all in one location?
Serjik [45]
I believe that the options are:

A. Menu bar
B. Help icon
C. Status barb
D. Backstage view

both status bar and backstage view have information about your document that you can view, but backstage view has more information and also information that you can also edit- so i believe that this is the best answer.

4 0
3 years ago
Alicia uses a software application to store the names, email addresses, and phone numbers of her friends in alphabetical order. 
SpyIntel [72]

I think she's using Excel.

6 0
3 years ago
The right to make others do things is referred to as _________.
Nady [450]

Answer:

I think B hope its right

3 0
3 years ago
Read 2 more answers
Other questions:
  • A species of snake lives in a rainforest. Which would be an adaptation for this
    10·2 answers
  • Write a program to read 10 integers from an input file and output the average, minimum, and maximum of those numbers to an outpu
    14·1 answer
  • What type of maintenance is required of a computer’s power supply to ensure that it remains in working order?
    15·2 answers
  • When you use information hiding by selecting which properties and methods of a class to make public, you are assured that your d
    14·1 answer
  • Which example task should a developer use a trigger rather than a workflow rule for?
    11·1 answer
  • A template class is a class in which ___________.
    15·2 answers
  • Your ISP connects to the core routers of the Internet via a O backbone O satellite O cable mode Ospine​
    9·1 answer
  • Majken is turning 18 years old soon and wants to calculate how many seconds she will have been alive.
    7·1 answer
  • Which directory stores the cron configuration file?.
    8·1 answer
  • the administrator in an Exchange Server needs to send digitally signed and encrypted messages. What should the administrator use
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!