Rewrite the function pentagonal using recursion

Assignment Help Business Management
Reference no: EM132222074

Consider the following iterative function:

int pentagonal(int n)

{

int result = 0;

for (int i = 1; i <= n; i++)

result += 3 * i - 2;

return result;

}

Rewrite the function pentagonal using recursion and add preconditions and postconditions as comments. Then prove by induction that the recursive function you wrote is correct.

Reference no: EM132222074

Questions Cloud

When would you choose to use static routing : When would you choose to use static routing, instead of letting dynamic routing take care of the routing paths for you?
What are the basic earnings per share for craven ltd : For the year ended 30 June 2014, the net income after tax was $20 000 000. What are the basic earnings per share for Craven Ltd for the year ended 30 June 2014
Identifying training needs and supporting training on job : Explain the role of the manager in identifying training needs and supporting training on the job.
Given the side lengths and all four angles : Question: Given the side lengths and all four angles of a quadrilateral, determine if the shape is a square, rectangle, or neither.
Rewrite the function pentagonal using recursion : Rewrite the function pentagonal using recursion and add preconditions and postconditions as comments. Then prove by induction that the recursive function
What company do you want to work for : As an IT student what is your dream job upon graduation? What company do you want to work for?
Privacy issues relative to our national security : It is ironic that at the same time that we are struggling with privacy issues relative to our national security
Difference between for-each loop and for loops in java : What is the difference between for-each loop and for loops in java?
Utilize the customer lifetime value : How does Lululemon utilize the Customer Lifetime Value (CLV) to figure out that their primary target is females around 30 years old,

Reviews

Write a Review

Business Management Questions & Answers

  Skills framework for the information age

The Skills Framework for the Information Age (SFIA) is one of the frameworks developed to guide professionals or aspiring professionals

  Business issue identification

For this discussion, you will gather sources of information based on a health care business issue, which can be administrative or managerial. In this discussion, you will define your problem and identify the goals you are trying to achieve.

  How strong brands can lead to a more sustainable future

How Strong Brands Can Lead to a More Sustainable Future

  Sunbeam owners spares club

The Sunbeam Owners Spares Club (In the actual exam, the case study is different but of a similar length) Sunbeam are the world's third oldest car company

  What is the annual inventory turnover

Suppose demand is 45 units a month, average inventory is 60 units, and unit cost is $20. What is the annual inventory turnover? Why does project management often involve the management of conflict?

  Determining the unplanned comparisons

Explain why post-hoc tests are referred to as "unplanned" comparisons? Hint: In what instances would you use a post-hoc test?

  Value chain and the achievement of competitive advantage

Choose and analyze two examples of companies that have been successful in this integration - Choose and analyze two examples of companies

  Evaluate the impact on the budgeted statements

Evaluate the impact of this on the budgeted statements contained in the case study - Review the readings and media for this unit, including the Anthony's Orchard case study media.

  Grow a marketing plan to guide a doggie day-care center

Grow a marketing plan to guide a doggie day-care center to a leading position in the market having the exclusive characteristics of services such as- inseparability, intangibility, variability and perishability

  Define porter article fit with the explosion of social media

How does the Porter article fit with the explosion of social media? Does it help us better recognise the future direction of the competitive environment? Why?

  Analyze economic trends across different industries

Many companies hire economists to analyze economic trends across different industries and markets in order to help them design strategies for the future.

  Explain why each place you selected would be a viable option

Select at least five (5) places you would recruit for a customer service assistant and at least five (5) places you would recruit for production line workers. Explain why each place you selected would be a viable option for recruiting employees

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd