Question: Due date: Saturday, 2 0 / 4 / 2 0 2 4 ( No Assignments will be accepted after the mentioned date, with no exceptions.
Due date: Saturday, No Assignments will be accepted after the mentioned date, with no
exceptions.
The assignment is an individual effort. Copying the assignment will be treated as a cheating attempt, which
may lead to FAILING the course.
Try your best to be precise and organized in presentinganalyzing results.
The report must be submitted in pdf format. You need to include all your code as well.
This assignment focuses on factorial calculation, a fundamental mathematical operation that can be
approached using various methods. We will explore two such methods: iterative and recursive. By
implementing and comparing both approaches, you will gain insights into their efficiency and limitations
This exercise provides an opportunity to measure execution times for different input values, observe how
large values affect the stack, and learn how to handle large results by selecting appropriate data types.
Through this assignment, you'll strengthen your understanding of programming and algorithmic practices.
Instructions:
Implement an iterative function to calculate the factorial of a given integer
Implement a recursive function to calculate the factorial of
Test both functions with various values of starting from small values eg and gradually
increasing to larger values.
Measure and record the execution time for each test case. You can use builtin timing libraries or
functions available in your chosen programming language.
Choose a sufficiently large value of eg for both functions.
Attempt to calculate the factorial for this large value of to observe the stack overflow issue. Record
the outcome.
Note: Use appropriate data types to handle large results like long long
Report
Write a technical report about the experiments you have made maximum of pages The report should
contain the following:
Show execution time results in a presentable way using tables and charts
Provide stack overflow observations.
You should discuss what you have found.
Conclude the work as a whole.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
