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
The first window displayed when you install opensuse is the ____ window.
Jlenok [28]
Is the <span>Boot Options window.</span>
3 0
3 years ago
Assume you have 100 values that are all different, and use equal width discretization with 10 bins.
zepelin [54]

Answer:

a) 10

b) 1

C) 10

D) 1

E) 20

F)  10

Explanation:

a) The largest number of records that could appear in one bin

 = 10

B) The smallest number of records that could appear in one bin

= 1

C) The largest number of records that cab appear in one bin

= 10

d) smallest number

= 1

e) With frequency = 20. the largest number of records that could appear in one bin with equal width discretization (10 bins)

= 20

f ) with equal height discretization

= 10

6 0
3 years ago
__________ loads Windows with a minimum configuration and can create a stable environment when Windows gets corrupted
Tju [1.3M]

Answer: Safe mode loads Windows with a minimum configuration and can create a stable environment when Windows gets corrupted

Explanation:

5 0
3 years ago
Write a program that reads a list of integers, and outputs those integers in reverse. The input begins with an integer indicatin
lyudmila [28]

Answer:

Following is the program in C language :

#include <stdio.h> // header file

#define n 5 //  macro

int main() main function

{

   int a[n],k1; // variable and array declaration

   printf("Enter the element:\n");

   for(k1=0;k1<n;++k1) //iterating the loop

   {

       scanf("%d",&a[k1]);//Read the values by user

   }

   printf("Output in Reverse Order:\n");

   for(k1=n-1;k1>=0;--k1)//iterating the loop

   {

   printf(" %d ",a[k1]); //Display the values

   }

   return 0;

}

Output:

Enter the element:

4

3

45

67

89

Output in Reverse Order: 89 67 45 3 4

Explanation:

Following is the description of the program

  • Define a macro "n" with value 5 after the header file.
  • Declared an array "a" and defined the size of that array by macro i.e "n".
  • Read the value by the user by using scanf statement in the array "a"
  • Finally In the last for loop display the values of array "a" by space.

7 0
3 years ago
The rule of thumb that predicts that the number of transistors on a cpu will double every two years is called ________ law.
ivann1987 [24]
The rule of thumb that predicts that the number of transistors on a CPU will double every two years is called Moore's law.<span> The father of the Moore's law is Intel co-founder Gordon </span>Moore in 1965. This law states that <span>the number of transistors per square inch on integrated circuits had doubled every year since their invention.</span>
7 0
3 years ago
Other questions:
  • Why is a port scan detected from the same ip on a subnet an alarming alert to receive from yourids?
    5·1 answer
  • Tikenya was responsible for creating the PowerPoint presentation for the group project. When it was complete, she wanted to emai
    12·2 answers
  • Typically, the first item in defining a function is _____. (Points : 4)
    6·1 answer
  • (Help please I don't know what to choose because it's both text and email but I can only pick one. HELP!!!!!!!!!!)
    6·2 answers
  • Missing slot covers on a computer can cause?
    9·1 answer
  • How do computers benefit individuals' health care?
    10·1 answer
  • Need to know? Anyone feel like helping me not fail
    13·1 answer
  • What is the example of HTML?​
    13·1 answer
  • List the caveats to this analysis and how they affect the research. How does this document define the ""typical game developer""
    7·2 answers
  • You are writing code to store the length of a side of a square. Which one is a good variable name
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!