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
Which of the following lines correctly defines a String variable
lidiya [134]

Answer:

The answer to this question is given below in the explanation section.

Explanation:

The correct answer to this question is C i.e. String s = "apluse";

The rule or syntax of declaring string in any programming language is given below:

String variable-name = "yourString";

For declaring string variable, first, you write "String" that is a keyword of a programming languages for declaring string variables, such as int before the variable name for declaring integer variable. Then, you need to write a meaningful name of the string as a variable. After string variable name, you need to put the equal operator and then write the string in double quotation("") marks and after that put the instruction terminator that is ";".

So, according to this syntax, option C is correct.

While other options are not correct because:

In option a, string is not encapsulated in double quotation. Option B does not have varaible type such as String and Option E does not have variable name and its value also. So, only option C is correct and all other except C are incorrect.

3 0
2 years ago
Does any of yall know how to delete your account?
il63 [147K]

Answer:

No i really don't but why would you want to delete your account

8 0
2 years ago
What are characteristics of fluent readers? Check all that apply. reading known words automatically pronouncing words correctly
IRINA_888 [86]

Answer:

D,A,B hope this is it!!!!!

7 0
2 years ago
Read 2 more answers
Taking phrases, sentences, or paragraphs of text from a source then using them without giving attribution is plagiarism. This in
lys-0071 [83]

Answer:

True, that would be plagiarism

8 0
2 years ago
Which service works in conjunction with EC2 Autoscaling in order to provide predictive scaling based on daily and weekly trends
Lunna [17]

The service that works in conjunction with EC2 Autoscaling in order to provide predictive scaling based on daily and weekly trends is target tracking.

<h3>How can I employ Predictive Scaling with target tracking? </h3>

Predictive Scaling works is known to be one that works in line with target tracking. They both help to make one's EC2 capacity to change more better to one's incoming application traffic.

Note that target tracking scaling policies is one where a user has to select a scaling metric and set a target value.

Learn more about Autoscaling  from

brainly.com/question/17661222

4 0
2 years ago
Other questions:
  • 1- Design a brute-force algorithm for solving the problem below (provide pseudocode): You have a large container with storage si
    10·1 answer
  • A reaction between an acid and a base is both a neutralization reaction and what other kind of reaction?
    10·1 answer
  • Explain the purpose of Data Layer, in the Layered modelfor web applications?
    6·1 answer
  • What does ' array ' mean in the context of graphics programming ?
    12·1 answer
  • Thomas came into work this morning and turned on his computer and nothing happened. He immediately called the help desk, and you
    5·1 answer
  • The elements of an integer-valued array can be set to 0 (i.e., the array can be cleared) recursively as follows: An array of siz
    14·1 answer
  • Which computer was part of the first generation of computers?
    14·2 answers
  • An organization's Finance Director is convinced special malware is responsible for targeting and infecting the finance departmen
    13·1 answer
  • HELP ASAP, AND YES I KNOW, WRONG CATEGORY. SORRY!
    7·1 answer
  • Why does Brainly keep on giving me ads. All I want to do is get answers not be smothered by a bunch of ads. And then when you go
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!