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
You are configuring a wireless network with two wireless access points. Both access points connect to the same wired network. Yo
krok68 [10]

Answer:

have the same SSID but different channels

Explanation:

Based on the information provided within the question it can be said that the best option to accomplish this would be to have the same SSID but different channels. This would maintain the users connected to the same network name (SSID) but still be able to roam and jump from one access point to the other.

7 0
3 years ago
Read 2 more answers
The recommended flux for electrical soldering is A. antimony. B. sal ammoniac. C. rosin. D. muriatic acid.
expeople1 [14]
I pretty sure its D muriatic acid
3 0
3 years ago
Select the risks associated with the Internet.
tino4ka555 [31]
Sharing your personal information and identity theft but if you’re supposed to choose one then sharing your personal information must be right
3 0
2 years ago
Daniel was appointed one of three princes over all 120 governors in the kingdom of: Belshazzar, Darius, Nebuchadnezzar, Jerioaki
Dovator [93]
The correct answer is DARIUS.
It is written in the bible in Daniel chapter 6 verses one and two: ' It pleased Darius to set over the kingdom 120 satraps, to be over the whole kingdom. And over these, three governors of whom Daniel was one, that the satraps might give accounts to them, so that the king would suffer no loss. 
5 0
3 years ago
Please help!!!
Leona [35]

Answer:

C. Forms often provide special tools such as drop-down boxes for finding data.

Explanation:

3 0
3 years ago
Other questions:
  • If you were given a 3D microscope to use for photography, which object(s) would you most want to photograph?
    10·2 answers
  • Suppose that you created an robot that was so advanced it could act independently in very complex situations. It made its own de
    9·1 answer
  • The internet connects millions of computers connected through millions of ____ worldwide.
    9·1 answer
  • Which toolbar is located next to the office button and contain the commonly used commands​
    15·1 answer
  • Suppose two hosts, A and B, are separated by 20,000 kilometers and are connected by a direct link of R = 2 Mbps. Suppose the pro
    5·1 answer
  • Explain why the intangibility of Software System poses special problems for Software Project Management
    11·1 answer
  • The velocity dimension of Big Data refers to _____.
    15·1 answer
  • Describe your previous personal or professional experience with Microsoft Word.
    9·1 answer
  • How to solve level 53 on rapid router?
    11·1 answer
  • The ________ function will change a character argument from lowercase to uppercase. isupper toupper tolarge fromlower none of th
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!