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
You would like to search for information about storms but not tornadoes. What type of search strategy may be useful?
Norma-Jean [14]

Answer:

boolean search

Explanation:

4 0
3 years ago
Read 2 more answers
How is information sent across the internet binary
Annette [7]

Answer:

Binary information must be encoded in some way before transmission over the Internet. ... Copper wire is used to transmit binary messages using electricity - a voltage on the wire means one state, and no voltage means the other. Fiber-optic cables, on the other hand, use light (on or off) to transmit a binary message.

8 0
3 years ago
Fred has to write a report on the general opinion of the influence of television on political decision-making. What internet res
Amiraneli [1.4K]
B. forum
they hold the most accurate information and people respond the most
3 0
3 years ago
Read 2 more answers
Are principles which allow designers to create blank designs
Lady_Fox [76]

Answer:

Seven principles guiding blank design

see below

Explanation:

The correct question should be What Are principles which allow designers to create blank designs

"Are principles which allow designers to create blank designs"

Blank design first screen user is presented with when about to start something new.

The seven principles are

  • Balance
  • Rhythm
  • Pattern
  • Emphasis
  • Contrast
  • Unity
  • Movement
7 0
3 years ago
There is an increasing need for private security personnel because of declining resources for many government agencies and a sho
aivan3 [116]
<span>True
</span><span>There is an increasing need for private security personnel because of declining resources for many government agencies and a shortage of police officers in many communities due to lack of funding.

</span>
8 0
4 years ago
Other questions:
  • 1. Mobile devices have a _________ viewport that displays a web page content that fits within a mobile screen.
    11·1 answer
  • Refer to the exhibit. the gigabit interfaces on both routers have been configured with subinterface numbers that match the vlan
    11·1 answer
  • After the following code is executed what will be displayed on the screen? bool correntEmployee = true; double empSalary = 45000
    7·1 answer
  • Which online resource is usually not free?
    10·2 answers
  • Write a short program that allows the user to input a positive integer and then
    5·1 answer
  • Research and discuss the LAMP (Linux, Apache, MySQL, and PHP) architecture. What is the role of each layer of this software stac
    14·1 answer
  • Releasing refrigerant R-12 into the atmosphere is a criminal offense
    5·2 answers
  • A garments manufacturing company buys various types of natural and synthetic materials to produce clothes. Which material is a s
    6·2 answers
  • 1. Which of the following is not true about high-level programming language s? (a) Easy to read and write (b) Popular among prog
    12·1 answer
  • Both tangible and intangible property? are not covered by intellectual property protections. are both covered by intellectual pr
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!