Professional Writers
We assemble our team by selectively choosing highly skilled writers, each boasting specialized knowledge in specific subject areas and a robust background in academic writing
Fill the order form details - writing instructions guides, and get your paper done.
Posted: February 26th, 2022
ASSIGNMENT 2A
Design a program/project/driver class (the program/project/driver class file should be called YourNameAssignment2A; replace YourName with your actual name), that is going to show your understanding of program complexity on different solutions to the same problem.
Part 1. Add to your YourNameAssignment2A driver class the following 3 methods (use the exact/precise names) to compute Nth element of the following series (representing the sum of the squares of the first N positive integers): 1+22+32+…N2
Method Description
Method1 A recursive method with parameter N that used recursion to compute the Nth element in the series.
Method2 A brute method with parameter N that uses a loop to compute the Nth element in the series.
Method3 A mathematical method with parameter N that uses mathematic summation formula1 to compute the Nth element in the series.
In your main method, call all the 3 methods Method1, Method2, and Method3 to determine which of the 3 methods is faster by computing the run time 2 needed for the following 5 values for N : 100000 (a hundred thousand), 1000 (1
thousand), 10 (ten), -1000 (negative one thousand), and -1000000 (negative one hundred thousand) and output the values or ERROR3 (if you run into a memory Overflow or Out of Memory issue even after using the largest integral type) in a table format below (no lines needed) in which each cell has the run time for that method for that value for N.
NMethod Method1 Method2 Method3
100000
1000
10
-1000
-100000
Part 2. Compute the complexity of each of the 3 methods/algorithm using the Big O notation and add the calculations for each of the 3 methods into a Microsoft Word document called YourNameAssignment2A-Complexity.docx (replace YourName with your actual name). You should show the Big O notation calculation for the method complexity for each one of the 3 methods. Which of the 3 methods is the best one? Add your answers to the document in the table bellow: in column to the complexity of that method in Big-O notation and on the third column the Big O notation calculation for the method complexity with explanations. For the Best Method, explain why the listed method is the best.
Method Complexity in Big O notation Calculation/Explanation
Method1
Method2
Method3
Best Method
Part 3: Create a document Create a Microsoft Word document called YourNameAssignment2A-Screeshots.docx (replace YourName with your actual name) that contains screenshots of the complete JAVA source code in the IDE and the complete program output. If the entire class JAVA source code or the output does not fit in one screenshot or the screenshots cannot be easily read, create multiple screenshots and add them to the same document.
Submit YourNameAssignment2A.java JAVA source code file, YourNameAssignment2A-Complexity.docx complexity analysis document, and YourName-Assignment2A-Screenshots Microsoft Word screenshots document on eCampus under the Assignment2A. Do not archive the files (no ZIP, no RAR, etc) or submit other file formats. Review the files in your eCampus submission confirmation window.
1 Look at this website to find the formula and, if interested, to see how it is computed https://brilliant.org/wiki/sum-of-n-n2-or-n3/ 2 You can compute the run time using the System.nanoTime() method 3 Output “ERROR” if you run into a memory Overflow or Out of Memory issue even after using the largest integral type
https://brilliant.org/wiki/sum-of-n-n2-or-n3/
https://docs.oracle.com/javase/7/docs/api/java/lang/System.html#nanoTime()
————
2A ASSIGNMENT
Create a program/project/driver class (the program/project/driver class file should be called YourNameAssignment2A; replace YourName with your real name) to demonstrate your understanding of program complexity on multiple solutions to the same problem.
Part 1. Add the following three methods (use the exact/precise names) to your YourNameAssignment2A driver class to compute the Nth element of the following series (representing the sum of the squares of the first N positive integers): 1+22+32+…N2
Description of the Method
Method1 A recursive algorithm with parameter N that employed recursion to find the Nth element of a series.
Method2 A brutal approach with parameter N that employs a loop to find the Nth member in a series.
Method3 A mathematical method with parameter N that uses mathematic summation formula1
You Want Quality and That’s What We Deliver
We assemble our team by selectively choosing highly skilled writers, each boasting specialized knowledge in specific subject areas and a robust background in academic writing
Our service is committed to delivering the finest writers at the most competitive rates, ensuring that affordability is balanced with uncompromising quality. Our pricing strategy is designed to be both fair and reasonable, standing out favorably against other writing services in the market.
Rest assured, you'll never receive a product tainted by plagiarism or AI-generated content. Each paper is research-written by human writers, followed by a rigorous scanning process of the final draft before it's delivered to you, ensuring the content is entirely original and maintaining our unwavering commitment to providing plagiarism-free work.
When you decide to place an order with Nurscola, here is what happens: