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
________ are the primary means of authentication for a user's computer and other networks and servers to which the user may have
inn [45]

Answer:

The answer to this question is "Password".

Explanation:

In computer science, any User's computer and networks and server is secured with the password to access all we use the password. for example, if we want to access any WiFi system or any User's computer. Then we will insert the password. If the password is wrong so we can't access the WiFi system or User's computer. similarly, If we want to access any server so we must know about the password. Then we use the server and change it's setting.

So the password is the primary means of authentication for all User's.  

4 0
3 years ago
Which of the following expressions yields an integer between 0 and 100, inclusive? Question 5 options: (int)(Math.random() * 100
Alex17521 [72]

Answer:

(b) (int)(Math.random() * 101)

Explanation:

Given

min = 0 --- minimum

max =100 --- maximum

Required

Java expression to generate random integer between the above interval

The syntax to do this is:

(int)(Math.random((max - min) + 1) + min)

Substitute the values of max and min

(int)(Math.random((100 - 0) + 1) + 0)

Simplify the expression

(int)(Math.random(100 + 1) + 0)

(int)(Math.random(101) + 0)

(int)(Math.random(101))

Hence, the right option is:

(b) (int)(Math.random() * 101)

3 0
2 years ago
In his article, “How to Publish Without Perishing,” what does James Gleick believe most people do when they really read a book?
jonny [76]

Answer:

James Gleick believes that they immerse themselves in a rich textual world. The answer is C.

3 0
2 years ago
Read 2 more answers
Text box linking is for two or more text boxes in a document, when the text overflows from the first box. Which scenario is the
Julli [10]

Answer:

Explanation:

use the next box i think

8 0
2 years ago
Read 2 more answers
Enter just the letter of the correct answer
Viefleur [7K]

Answer:

C. WDS

Explanation:

DND is for rolling dice and arguing about alignments

WiFi Analyzer just monitors your WiFi's stats and health

--> WDS lets you wirelessly connect two routers for larger range

DHCP is for IP address distribution.

3 0
3 years ago
Other questions:
  • An intranet is an external network.TrueFalse
    15·1 answer
  • What internet service provider first dominated the internet in the 1990s?
    15·1 answer
  • How does classless inter-domain routing (cidr) help reduce waste of ip addresses?
    8·1 answer
  • Having just one error on a cover letter may eliminate an applicant from being considered for employment?
    13·1 answer
  • What is Human Dignity
    12·1 answer
  • Users of an access point share the transmission capacity of the access point. The throughput a user gets is called the ________.
    11·1 answer
  • What is the result of executing the following code? You can assume the code compiles and runs. #include using namespace std; voi
    6·1 answer
  • What output is generated by this for loop?
    6·1 answer
  • Susan works for a company that values their employees me and deadlines in finding ways to keep the cost of doing business low wh
    12·1 answer
  • What Is entered into the system as input?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!