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]
4 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]4 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
What option would you choose in order to store the database on a dedicated sql server?
Ganezh [65]
<span>Single processor servers offer high performance and locked-down security for any website or application. Upgrade to a bundle and save on services like backups and DDoS protection.</span>
7 0
3 years ago
A transmission system at a radio station uses a/an _______ to convert a direct current into a high-frequency alternating current
xenn [34]
The answer is A. oscillator 
5 0
3 years ago
Why did we decide to send a message as a sequence of two options rather than modifying our devices to represent more options?
yaroslaw [1]

Answer:

Following are the solution to this question:

Explanation:

Please find the complete question in the attachment file.

The binary message is also an XML text SMS, which is used to represent in binary character. It may also flag the binary text as binary, and it can attach the UDH as just the start of its message. In this question, we assume that you can include A and B because there could be no more than 2 choices in such a binary message.

8 0
3 years ago
Paul has been working long hours. He is tired and distracted by family issues, so he has not been doing record updates regularly
mina [271]

Answer:

Accidental data loss

Explanation:

Accidental data loss -

It refers to the removal or loss of certain data or information from the computer , due to some accident , is referred to as accidental data loss .

The loss of data can be due to some malicious intruders , or can be due to the fault of the user .

The information can be lost due to sudden power cut , natural calamities like fires , flood earthquake etc. , problem in hard disk etc.

Hence , from the given scenario of the question ,

The correct option is accidental data loss.

4 0
3 years ago
Produce a program using a loop that requests for 8 floating point numbers from a user.once provided the program should calculate
kati45 [8]

Answer:

The program in Python is as follows:

total = 0

count = 0

for i in range(8):

   num = float(input())

   if num < 10.5:

       total+=num

       count+=1

print("Average: ",total/count)

Explanation:

This initializes the total to 0

total = 0

This initializes the count to 0

count = 0

This loop is executed 8 times

for i in range(8):

This request for float number

   num = float(input())

If input is less than 10.5

   if num < 10.5:

The sum is taken

       total+=num

And count is incremented by 1

       count+=1

The loop ends here

This calculates and prints the average

print("Average: ",total/count)

7 0
3 years ago
Other questions:
  • Which of the following is a feature that is in the Excel program and NOT in Word? (Select all that apply.)
    14·1 answer
  • How does the access point know whether a wireless data packet is intended for its network?
    14·1 answer
  • .<br> 1. Press the _______ key to move to the next cell in a row.
    14·2 answers
  • Arman, a friend of your dad, has a computer running Windows 7 and wants to perform an upgrade. He has only 3GB of RAM in his com
    13·1 answer
  • Why do we allow electronic instruments to warm-up before use?
    11·1 answer
  • A circuit rated at 6600 watts and 240 volts will draw what ampers.
    6·1 answer
  • Write an expression that will cause the following code to print "Equal" if the value of sensorReading is "close enough" to targe
    15·2 answers
  • PLEASE HELP! One of the nice byproducts of joining a club, organization, community service project, or service learning project
    6·1 answer
  • . Which of the following are container elements?
    14·2 answers
  • To excel at these professions, you need to be able to combine an eye for elegant design with a mind that delights in efficient o
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!