subject

What is the time complexity of the following algorithm power(n, x).? Assume that each operation takes a unit time. LongPower(int n, int x)
long ans
if(na=0) return
else 1
ans Power (n/2, x) Power (n/2, x);
if (n % 2 = 1)ans*-x;
return ans;
T(n)=T(n-1) +0(1)
T(n)=T(n/2) T(n/2)+0(1)
T(n) = 2T(n/2) + 0(1)
T(n) = 2T(n-1 ) + 0(1)

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 15:10, AleciaCassidy
Consider a direct-mapped cache with 216 words in main memory. the cache has 16 blocks of 8 words each. it is a word-addressable computer (rather than a byte-addressable computer which we normally discuss). (a) how many blocks of main memory are there? (b) what is the format of a memory address as seen by the cache, that is, what are the sizes of the tag, cache block, and block offset fields (if they apply)? (c) to which cache block will the memory reference db6316 map?
Answers: 1
image
Computers and Technology, 23.06.2019 02:00, deeknuk
What is the main benefit of minimizing the ribbon in word? more options will be accessible through customized keystrokes. more of the document will be viewable without needing to scroll. fewer controls will be accessible to the user by using the mouse. fewer editing options will be available without entering a password.
Answers: 1
image
Computers and Technology, 23.06.2019 06:00, hilarydodard7099
Which statistical function in a spreadsheet you to see how far each number varies, on average, from the average value of the list?
Answers: 2
image
Computers and Technology, 23.06.2019 13:00, dimondqueen511
Which one of the following voltages should never be measured directly with a vom? a. 1200 v b. 500 v c. 800 v d. 100v
Answers: 2
You know the right answer?
What is the time complexity of the following algorithm power(n, x).? Assume that each operation take...

Questions in other subjects:

Konu
Mathematics, 21.01.2021 04:10
Konu
Social Studies, 21.01.2021 04:10