Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

the link: https://www.calculator.net/log-calculator.html StringExperiment.java: public class StringExperiment { /** Uses repeated concatenation to compose a String with n copies of character c. */ public static

image text in transcribed

the link: https://www.calculator.net/log-calculator.html

StringExperiment.java:

public class StringExperiment { /** Uses repeated concatenation to compose a String with n copies of character c. */ public static String repeat1(char c, int n) { String answer = ""; for (int j=0; j 0) trials = Integer.parseInt(args[0]); if (args.length > 1) n = Integer.parseInt(args[1]); } catch (NumberFormatException e) { } int start = n; // remember the original starting value // let's run version 2 (the quicker one) first System.out.println("Testing repeat2..."); for (int t=0; t Perform an experimental analysis of the two algorithms prefixAveragel and prefixAverage2 given in file PrefixAverage.java. Visualize their running times as a function of the input size with a log-log chart (A log-log chart is a two-dimensional graph where the x-coordinates and ycoordinates are logarithmic values [base of log should be same in both axes]). A log calculator can be found in https://www.calculator.net/log-calculator.htm1. Do the log-log chart using Microsoft excel and submit the screenshot of the graph. (Hint: Choose representative values of the input size n, similar to StringExperiment.java in Lesson4Examples.zip posted in the eCentennial module "Lesson Examples (from textbook)". You might like to use System class's method nanoTime( instead of the method currentTimeMillisO) ). (5 marks) Perform an experimental analysis of the two algorithms prefixAveragel and prefixAverage2 given in file PrefixAverage.java. Visualize their running times as a function of the input size with a log-log chart (A log-log chart is a two-dimensional graph where the x-coordinates and ycoordinates are logarithmic values [base of log should be same in both axes]). A log calculator can be found in https://www.calculator.net/log-calculator.htm1. Do the log-log chart using Microsoft excel and submit the screenshot of the graph. (Hint: Choose representative values of the input size n, similar to StringExperiment.java in Lesson4Examples.zip posted in the eCentennial module "Lesson Examples (from textbook)". You might like to use System class's method nanoTime( instead of the method currentTimeMillisO) )

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

Joe Celkos Data And Databases Concepts In Practice

Authors: Joe Celko

1st Edition

1558604324, 978-1558604322

More Books

Students also viewed these Databases questions