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
Write a program in python to test if given number is prime or not.
Paraphin [41]

Answer:

Answer:

def main():

num = int(input("Input a number to check for prime: "))

if num > 1:

 for i in range(2,num):

  if (num % i) == 0:

   print("%d is not a prime number" % num)

   break

  else:

   print("%d is a prime number" % num)

   break

else:

 print("%d is not a prime number" % num)

 

if __name__ == "__main__":

main()

Explanation:

Solution retrieved from programiz.com.

Note, this program uses the idea of the Sieve of Eratosthenes to validate the input number by using the modulo operator to determine primeness.

The program will output to the user if the number input is indeed prime or not.

Cheers.

Explanation:

4 0
2 years ago
Read 2 more answers
What type of encoding is this?<br>0x6a656c6c7966697368<br>cause I'm trying to decode it
katen-ka-za [31]
According to its structure I'd say that this is SEAL (<span>Software-Optimized Encryption Algorithm). It's difficult to describe how it works, because this kind of ciphers is very tricky. This algorithm uses 160 bit key and it uses 3 tables (R, S, T) to encode and decode.

I'll attach the image where you can see a process of creating a pseudo-random function:
</span>

7 0
3 years ago
Harvey is not happy with the software that allows the programmer to write and run code and wants to find something new. If Harve
Assoli18 [71]

Answer:

D. integrated development environment

Explanation:

Given that an integrated development environment is a form of computer software App that allows the users or programmers to develop a software App in a way the enables them to carry out different operations including source code development, build and test automation, and debugging activities.

For example NetBeans, Eclipse, IntelliJ, and Visual Studio.

Hence, in this case, the correct answer is "integrated development environment."

3 0
3 years ago
In PKI, the CA periodically distributes a(n) _________ to all users that identifies all revoked certificates.
Trava [24]

Answer:

" CRL (certificate revocation list)" is the appropriate answer.

Explanation:

  • A collection of such subscriber bases containing accreditation or certification status combined with the validation, revocation, or outdated certification within each final customer is known as CRL.
  • Only certain subscribing workstations with a certain underlying cause authentication system should have been duplicated.
4 0
3 years ago
Which of the following is not a true statement about Christopher Columbus it oko
Thepotemich [5.8K]

Answer:

  • There has been a need to explore the different regions across the globe in the early ages, as there were ships to travel but there was no one before who knew about the different routes and maps of the region, so, it was sort of blind folded traveling when some one wanted to go far distances yet some of them knew about other regions on the far sides of many seas having a unique culture, different languages, along with having diversity among the flora and fauna inside the region.
  • So, like many other curious people across the globe there was a need for the people to explore all the regions. As, it was a need for the travelers and all the rest of free fork to know about this world. Now, every wanted to know more about the different lands but there were few who even performed the great feat, as they had fear for their lives.While, Christopher Columbus was more into sacrificing his own life in order to explore the lands at the far lands across the Pacific ocean. As, he arranged his mind and covered all the required arrangements for the journey.
  • As, was at first wanted to explore the lands of far east and thus wanted to more about the Subcontinent India, but in turn he reached the lands of the American continent in far west.While, upon arriving the American region we say many people with different skin tone, culture and language which was very different then he heard about the people of India.There was more different world then he could ever think of as he had a lot to tell about these lands upon the way back to Europe or his home land.

7 0
3 years ago
Other questions:
  • Which is a function of network media?
    14·2 answers
  • ____ is typically used with lans that have a star topology and can be used in conjunction with twisted-pair, coaxial, or fiber-o
    12·1 answer
  • Someone once observed that "the difference between roles and groups is that a user can shift into and out of roles, whereas that
    13·1 answer
  • How can I make a website login system with only using php?​
    6·1 answer
  • If we can lock a file, we can solve the race condition problem by locking a file during the check-and-use window, because no oth
    14·1 answer
  • A type of VPN connection, where a single computer logs into a remote network and becomes, for all intents and purposes, a member
    13·1 answer
  • What is a feature of Print Preview? Fit to Document Fit to Margin Fit to Page Fit to Size
    5·2 answers
  • Gimme Shelter Roofers maintains a file of past customers, including a customer number, name, address, date of job, and price of
    8·1 answer
  • Three reasons Why we connect speakers to computers
    15·2 answers
  • WHAT ARE SOME PROS AND CONS OF HYDROGEN FUELL CELLS
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!