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
Which of the following statements is true of San serif fonts?
Vsevolod [243]
They are easier to read on a computer screen
7 0
3 years ago
Read 2 more answers
Active directory is a useful case scenario for nano server. group of answer choices true false
topjm [15]

Active directory is a useful case scenario for nano server. group of answer choices true false

Active directory is a useful case scenario for nano server is a false statement.

An active directory domain controller cannot be a typical use case scenario for Nano Server. Nano Server cannot function as a domain controller for your Active Directory and as a proxy server compared to Server Core or Server with Desktop Experience.

Learn more about active directory domain controller here:

brainly.com/question/28235161

#SPJ4

3 0
2 years ago
We are just beginning to study branch instructions, but they are actually quite easy to understand. In a branch instruction, a t
AURORKA [14]

Answer:

Code is given as below:

Explanation:

globl main

   main:

       li $v0, 4      

       la $a0, prompt

       syscall

       li $t0, 0      #count for the loop to get two integers

   getnum:

       li $v1, 5   #read integer

       syscall

       addi $t0, $t0, 1    #increment the counter

       ble $t0, 2, getnum        

   printnum:  

       bgez $v0,syscall1

       bgez $v1,syscall1        #load address of num to print

       

       li $v0, 10

       syscall

.data

   data1: .word 0x63f2e3

   data2: .word 0x9100ab72

   prompt:

       .asciiz "Enter 2 numbers:"

4 0
3 years ago
Choose one of the following about video games
Marizza181 [45]

Answer:

decrease in social interactions

Explanation:

if you play a video game you are starring at a screen and you are not interacting with people

5 0
3 years ago
Hello,
Jlenok [28]

Answer:

C, C, B, C, C, B, B or D, D, A or C, A, D

Explanation:

I am not taking whatever course you are taking, but I would like to know what you're taking. I have only answered the questions to the best of my abilities, so they might be wrong. Next time please award more points for a question so long.

7 0
3 years ago
Other questions:
  • A(n) ________ software installation enables you to decide which features you want to install on the hard drive
    10·1 answer
  • Face book requires you to change your password regularly<br> a. TRUE<br> b. FALSE
    14·1 answer
  • List 7 basic internal component found in a computer tower?
    11·2 answers
  • Business: check ISBN-13) ISBN-13 is a new standard for identifying books. It uses 13 digits d1d2d3d4d5d6d7d8d9d10d11d12d13.
    14·1 answer
  • What is the output of the following program?
    5·1 answer
  • Functions are ideal for use in menu-driven programs. When a user selects a menu item, the program can_______ the appropriate
    5·1 answer
  • ___________ are the constant values that are used in a program. ​
    14·1 answer
  • In this line of code, what does 144 refer to?
    12·1 answer
  • Create a relational database table in Microsoft Excel for the grocery store of 20 employers.
    12·1 answer
  • While operating a vehicle on any highway of this state, it it illegal to physically hold or support a wireless device with any p
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!