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
Drupady [299]
3 years ago
14

Implement a sublinear running time complexity recursive function in Java public static long exponentiation (long x, int n) to ca

lculate x^n. Note: In your function you can use only the basic arithmetic operators (+, -, *, and /).
Computers and Technology
1 answer:
Archy [21]3 years ago
8 0

Answer:

Following are the code block in the Java Programming Language.

//define recursive function

public static long exponentiation(long x, int n) {

//check the integer variable is equal to the 0.

if (x == 0) {

//then, return 1

return 1;

}

//Otherwise, set else

else {

//set long data type variable

long q = exponentiation(x, n/2);

q *= q;

//check if the remainder is 1

if (n % 2 == 1) {

q *= x;

}

//return the variable

return q;

}

}

Explanation:

<u>Following are the description of the code block</u>.

  • Firstly, we define the long data type recursive function.
  • Then, set the if conditional statement and return the value 1.
  • Otherwise, set the long data type variable 'q' that sore the output of the recursive function.
  • Set the if conditional statement and check that the remainder is 1 and return the variable 'q'.
You might be interested in
They have outlined their technical needs and have sent some of the documentation along with the potential provider's SLAs and te
iren2701 [21]

Answer:

A concern that might be expressed by the legal department after reviewing the SLAs and terms of service is:

c. Ensuring that there is a guarantee that the cloud service provider will provide notice in the event that they decide to discontinue operations.

Explanation:

The SLA that the legal department will review should include a description of the services to be provided, expected service levels, measurement metrics for each service, each party's duties and responsibilities, and the contract remedies or penalties for breach, among others.  But the legal department will be mostly concerned with legal remedies during breaches, liability limitation and warranties, and intellectual property protection issues than with more technical issues.  This is despite the fact that all the terms of the SLA will be diligently reviewed by the legal department.

7 0
3 years ago
Renter’s insurance is not necessary if you don’t have a lot of expensive things.
attashe74 [19]

Wrong, You should get renters insurance to insure your items that you do have or will recieve in the future are safe

7 0
3 years ago
And, Or, Not are examples of:
yanalaym [24]
Boolean operators it is
all the best
5 0
3 years ago
Drag the tiles to the correct boxes to complete the pairs.
professor190 [17]

Answer: James is all of the above

Explanation:

4 0
2 years ago
WILL GIVE BRAINLIEST AND HALLOWEEN CANDY!!!!!!!!!<br> who wants to talk?
Tamiku [17]
<h2>Sure, I wanna talk. (:      .........................</h2>
3 0
3 years ago
Other questions:
  • Is there such a thing as an ethical reason for unauthorized access into a computer system?
    15·1 answer
  • Write a statement that adds 1 to the variable reverseDrivers if the variable speed is less than 0,adds 1 to the variable parkedD
    14·1 answer
  • Which of the following is not true about designing classes? In order for class information to be printed instead of a memory add
    12·1 answer
  • Select the term below which is a protocol that provides a method for software components to communicate, interact, and share dat
    6·1 answer
  • Due dates is the final date an assignment will be accepted. Plan ahead to ensure should you face difficulty with the assignment
    9·2 answers
  • Write a C++ program that determines if an integer is a multiple of 7. The program should prompt the user to enter and integer, d
    13·1 answer
  • Saujani describes that women are highly underrepresented in STEM careersShe attributes this to women needing more confidence. Wh
    13·1 answer
  • Which statements are true? Select 4 options.
    9·1 answer
  • 12. Your project specifications call for a business rule that the database design can't
    8·1 answer
  • Which cloud technology characteristic ensures that a cloud customer can make changes to her cloud database from her smartphone w
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!