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
defon
3 years ago
11

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:
Charra [1.4K]3 years ago
4 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
I need help!!! i will make you a brainliest!!
Ber [7]

Answer:

What you have is correct

Explanation:

3 0
3 years ago
What cell address indicates the intersection of the first row and the first column in a worksheet?
Roman55 [17]
The answer is A1. 

The columns are arranged alphabetically, and the rows are ordered numerically. The cell address states the column, a letter, followed by the row, a number. The first cell address, the top-left cell of the sheet, is A1
7 0
3 years ago
Read 2 more answers
Which thematic group is involved in the transmission and generation of electrical power?
MariettaO [177]

The thematic group involved in the transmission and generation of electrical power is the energy system. Thus, Option D is the correct answer.

<h3>What do you mean by thematic groups?</h3>

Thematic groups refers to groups that are made up of individuals who focus on the same theme or idea. Thematic Group specializes in the improvement of a selected talent or attitude so as for the group contributors to have the ability to finish a particular activity.

Thus, The thematic group involved in the transmission and generation of electrical power is the energy system. Option D is the correct answer.

Learn more about thematic groups:

brainly.com/question/17157087

#SPJ1

3 0
2 years ago
What is the best image format for our website if we needed our image to have a transparent background?
Rainbow [258]
PNG- Usually if you look up your picture and then add png to the end, it has a transparent background. Make sure it has free usage, though.
5 0
3 years ago
Name three output devices
san4es73 [151]

Monitor

Printers

Plotters.

8 0
3 years ago
Other questions:
  • The Sumif formula will add numbers together from a range of numbers ONLY IF they contain the criteria. True or false
    8·1 answer
  • Consider the following sequence of items 10, 36, 25, 54, 37, 12, 75, 68, 42, 86, 72, 90. Insert these items in the order above,
    5·1 answer
  • Whatis NOT a key factor while designing a website?
    12·1 answer
  • The game begins with the player having 20 POINTS
    11·1 answer
  • The most useful index fossils are of organisms that are still alive today.
    11·2 answers
  • You are a computer consultant called in to a manufacturing plant. The plant engineer needs a system to control their assembly li
    10·1 answer
  • Anyone know how to delete it in my laptop
    10·1 answer
  • You are asked to write a program that prompts the user for the size of two integer arrays, user input for the size must not exce
    13·1 answer
  • Briefly define each components of information systems (hardware, software, data, networking, people and procedure). While you ar
    6·1 answer
  • 9
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!