1. Write Java source code to take an integer n and returns the sum of all odd positive integers less than or equals to n. Please implement a sumOdd() method for major functionality and a main() method with input data for testing cases.
Please pay attention to the neat coding style in Java, including grammar, indentations, naming of variables and methods, and comments.
a) Conduct an experimental study regarding the running time of your Java code in nanoseconds. Please feel free to use excel to generate a figure on the evaluation results.
b) Analyze the time complexity and space complexity of your source code using asymptotic analysis.
c) Is there a way that your algorithm can be further improved regarding time and space complexity? Why or why not?
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here