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
What does it mean when the lottery machine says function suppressed after scanning a ticket
WARRIOR [948]

When a machine  says function suppressed after scanning a ticket, it implies that you have won some certain amount.

<h3>What is lottery  wins?</h3>

This term connote that a person has  a winning ticket in a lottery that is often owned by a government.

Note that  if a winning ticket is scanned, the terminal often shows a message just for you and that suppress function implies  that your the ticket has won something.

Learn more about lottery  from

brainly.com/question/9216200

6 0
2 years ago
To all paladins players out there!!!!!
Alex777 [14]

I am BORED PPL ..........

Explanation:

hi

6 0
3 years ago
An argument does not always have to be made in words. A piece of music
mixas84 [53]

Answer:

B. emotional

Explanation:

An emotional argument. An argument does not always have to be made in words.

4 0
3 years ago
This method is employed in order to rapidly change the locations of the website in order to ensure that no one site us used long
tester [92]

Answer:

Fast-flux

Explanation:

The techniques that is used to shift the network without shutdown of website.

4 0
3 years ago
A byte in memory is identified by a unique number called its
Murrr4er [49]
It is identified by its address number.
4 0
3 years ago
Other questions:
  • Knowing the meaning of the acronym WYSIWYG can be most helpful to you when you
    14·1 answer
  • Write a class named RetailItem that holds data about an item in a retail store. The class should store the following data in att
    15·1 answer
  • What is the recommended secure protocol for voice and video applications? secure real-time transport protocol (srtp) hypertext t
    9·1 answer
  • A communications medium that carries a large amount of data at a fast speed is called
    14·1 answer
  • A technician receives an invalid certificate error when visiting a website with port 443 enabled. Other computers on the same LA
    8·1 answer
  • Can someone tell me what this means Higfaa
    6·1 answer
  • Web designers use programming languages to write websites. A True <br> B False​
    15·2 answers
  • Create a mobile app plan using PowerPoint slides to show mock-ups of screens,
    6·1 answer
  • What is an issue with using cloud computing?
    15·1 answer
  • and assuming main memory is initially unloaded, show the page faulting behavior using the following page replacement policies. h
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!