Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

AT&T 4:51 PM a moodle3.lsu.edu 83%-- cialization that involves the ue of experimental and statistical, rather than heoretical, methods to analyse the behavice of algorithm

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
AT&T 4:51 PM a moodle3.lsu.edu 83%-- cialization that involves the ue of experimental and statistical, rather than heoretical, methods to analyse the behavice of algorithm Duncan Spring 2019 Big Inteer Exponentistion r 32 Project The goals olmprical algoeithnics are characterizaticn of an nlgutit on its perfoemaioe, enlancing the performance o gr using ei- cal techniques and the comarative nalysis of the rious algorithms that solve the same problem within a given context Definition 2. A power is an esxposeut to which a given quastity ise The expresin r" is therefore known as "Xto the s power." The esengs. tation of powers arise in many umerical algorithms You will write code to empirically compare the performance of a naive an the Jast algorithms for eompating powes of ponitive big integer vabes where power algoeithm Listing I: Naive Power Aleorithm ALGORITHN:SAIVE-POWER() Inpat:a on-segative i nteger apesinive integer Output: it F1 recurn endilgorith The power of a ber can be determinedoecienthy ing a scesive squaring algorith Spring 2019 AT&T 4:51 PM a moodle3.lsu.edu @ 83%-- 3 of 5 Duncan Spring 2019 Big lntegrr Exponntiation Here is a parudocode description of the algoeithm ALGORITHM: FAST-POVER C. C&3102. Prom #0 Litisg2Fast Pom lgeriehau Inpat:aon-segatire integer - psisive sseger Outpat: retura1 esdif endilgorith Read https/idocsoracle.com/jaee/8/doespl/awn/t/BigInteger I the API documestation for the Diglnteger class This elass allows for ep reseating very large integess and performing basie arithmetie operations on them The BigMath Class Compte the implementation of BigMathjene so that it contains static methols implementations for the nave and ft exponentiation algorithms Duncan Spring 2019 .'ll AT&T 4:51 PM a moodle3.lsu.edu Duncan Spring 2019 Se 3102 Projet O The PowerAnalyzer Program The Power Analyaer class will cosist of only one method, the ain. The main method will perform t ollowing tieks 1. It prompts the uer to the baswe of a poe It prompts the wer to enter the expoet of a pow 3. It conptes the posers using both the fast and naive algoritms and It randomly gerates a four-digit positive integ for the base of a It randomly gnerates a two-digit poeitive integer for the exponent of Similarly, it coemputes the powers using these randomly generated displays the s tegers and both the fast and naive algorithms and displays the powers It peompts the user for a ponitive integer to be used as the base in easaring and displaying rusties for geerating aarious powers of the base For n 16,32,64, 128,26,512, 1024.2048, 4006 8192, your program will compute, using the naive and fast exponentation algonithm owes times in dfor thoe algoeithm as shown in the talble in the ample run Additional Requirements Tst the program to ensure that it works corretly and gerates its output the salle kemat as shown in the sample run A 1teger calculator at ttp://wwwjaessoripler.set/math calealators/100digtigistealealdor can be used to verify that the powers calculated by your peogram are correct Duncan Spring 2019 Big nte Exponentiation CSe 310 AT&T 4:51 PM @ 83% a moodle3.lsu.edu Spring 201 5 of 5 Big lntegr Expntiation esc 3102. Propri o Each tile should have theoowing jadoes EXPLAS THE PURPOSE OF TKIS FLLE THE FILE WAS Abo, submit an exol specadkhot peertimesals containing the data g erated by your peogram and a line graph of execution times of ewch rithm inds (Y-axis) veesus jana and eo them albug with the spreadsbeet in a aip fie. Name the zip f YOUR PAWSID pre 00.ip, and subeit yoe peojnct for graling using the digjital ater the base od the poer 2 670330376 aing Fast Algeen: 2109 12060022822940549670363 Uning Saire Algorithm: 682-24 . ing Fast lgoritha: 362-24 Eater the base od the povers for the table 5468 54687 Duncan Spring 2019 Safari public class BigMath 4:51 PM 83% negative "Bigint" multiplication; multiplications n times This function computes the non-negative power of a non *for a given non-negative integer exponent using repeated given a base, b, and the exponent n, the function uses n-1 to compute b*b*bb, where b is used as a factor @param base a non-negative object of the Biglnt class @param n a non-negative integer @return the power of a big integer to the specified non- negative exponent @throw legalArgumentExcepiton when n is negative or base is not positive public static Biginteger naivePow (Biglnteger base, int n) throws lllegalArgumentException //lmplement this methoo This function computes the non-negative power of a positive "Biglnt" using the fast power algorithm that uses successive squaring @param base a positive object of the Bigint class @param n a non-negative integer @return the power of a big integer to the specified non- negative exponent @throw lllegalArgumentException when n is negative or base is not positive public static Biglnteger fastPow (Biginteger base, int n) throws lllegalArgumentException /Implement this method

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions