Cash-back offer from May 2nd to 7th, 2024: Get a flat 10% cash-back credited to your account for a minimum transaction of $50.Post Your Questions Today!

Question DetailsNormal
$ 18.00

UMUC CMSC 350 Homework 1 | Complete Solution

Question posted by
Online Tutor Profile
request

UMUC CMSC 350 Homework 1


Consider the polynomials with integer coefficients and positive integer exponents: P(x) = a0 * x0 + a1 * x1 + ... + an-1 * xn-1 For programming purposes, a polynomial is represented as an array of integers. The array cell of index i corresponds to the polynomial coefficient ai, where i represents the exponent of the variable x.
For example, if the polynomial is P(x) = 2 * x3 - 9 * x2 + 0 * x1 + 8 * x0, its representation as an array of size 4 is shown below:
8
0
-9
2
0
1
2
3
Consider the problem of calculating the polynomial value for an integer value of its variable x. As an example, for the above polynomial and for x = 2, the value of P(2) is -12.
a) Design and write the methods calculateBruteForce and calculateHorner for calculating the polynomial value for an integer value of x by using the brute force approach and respectively Horner's technique. Each method should take two parameters: the array of coefficients representing the polynomial and the value of x. When implementing calculateBruteForce method, define and invoke your own method for raising x to a given power by using repetitive multiplications, instead of invoking a predefined method such as the Math.pow(). (a1) By analyzing the code, determine and indicate time complexity for each of the two methods in terms of Big-O notation. (a2) Which of the two methods would perform better in terms of execution time? Explain.
b) Write a driver program CalculatePolyVal.java to validate the conclusions drawn from question a2). Consider a polynomial with 10 terms whose coefficients are stored in an integer array and are randomly generated in the interval -9 .. 9. Implement the following actions: (b1) Generate and display the polynomial
(b2) Generate and display a random integer value x in the interval 1 .. 9. (b3) Invoke the two methods and display the polynomial value returned by each method for the x value generated at (b2). (b4) Measure and display the execution time of the two methods as the arithmetic mean value of 105 executions. Use the method System.nanoTime() for determining the execution time. Discuss the obtained results. Are the results in line with your answer to question a? Note. Due to the behavior of the JIT compiler, the execution time of the repeated programs is much slower the first times they are run and therefore make sure to discard the measured values for the initial 5 runs. Submission requirements Submit the following before the due date listed in the Calendar: 1. The source file CalculatePolyVal.java. The source code should use Java code conventions and professional code layout regarding white space management, indents and comments. 2. The Solution description document <YourSecondName>_HW1 (.pdf or .doc / .docx) containing: (2.1) assumptions, main design decisions, error handling; (2.2) test cases and two relevant screenshots; (2.3) the answer and discussion required by questions a2) and b4); (2.4) lessons learned and (2.5) possible improvements. The size of the document file (including the screenshots) should be of two pages, single spaced, font size 12.

Available Answer
$ 18.00

[Solved] UMUC CMSC 350 Homework 1 | Complete Solution

  • This Solution has been Purchased 1 time
  • Submitted On 24 Jan, 2016 05:44:34
Answer posted by
Online Tutor Profile
solution
a1) Running time complexity of calculateBruteForce() is O(n^2) whereas ...
Buy now to view the complete solution
Other Similar Questions
User Profile
vpqnr...

UMUC CMSC 350 Project 3 complete solutions correct answers key

UMUC CMSC 350 Project 3 complete solutions correct answers key Quick Sort Optimizations through Hybridization 1. Specification Part 1 Consider the attached QuickSort algorithm for sorting arrays and two algorithm optimizat...
User Profile
vpqnr...

UMUC CMSC 350 Project 1 complete solutions correct answers key

UMUC CMSC 350 Project 1 complete solutions correct answers key 1. Specification Part 1 Design, implement and test a generic stack class StackUMUC (this name is chosen as to avoid confusion with similar classes defined in...
User Profile
Homew...

UMUC CMSC 350 Project 2 Balancing Binary Search Trees | Complete Solution

Protected TreeNode root; protected int size = 0; /** Create a default binary tree */ public BST() { } /** Create a binary tree from an array of objects */ public BST(E[] objects) { for (int i = 0; i < objects.len...
User Profile
Exper...

UMUC CMSC 350 Homework 1 | Complete Solution

A1) Running time complexity of calculateBruteForce() is O(n^2) whereas running time complexity of calculateHorner() is O(n). a2) calculateHorner() method will take less time because it takes O(n) time to perform the same ta...

The benefits of buying study notes from CourseMerits

homeworkhelptime
Assurance Of Timely Delivery
We value your patience, and to ensure you always receive your homework help within the promised time, our dedicated team of tutors begins their work as soon as the request arrives.
tutoring
Best Price In The Market
All the services that are available on our page cost only a nominal amount of money. In fact, the prices are lower than the industry standards. You can always expect value for money from us.
tutorsupport
Uninterrupted 24/7 Support
Our customer support wing remains online 24x7 to provide you seamless assistance. Also, when you post a query or a request here, you can expect an immediate response from our side.
closebutton

$ 629.35