Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this, we will write two recursive methods and two iterative methods to solve two problems. The first problem is the sum of squares. Your

In this, we will write two recursive methods and two iterative methods to solve two problems.

The first problem is the sum of squares. Your methods to solve this problem should have one parameter called k of type int. It should return the sum of the squares of the numbers up to and including k (i.e. it should return 1*1 + 2*2 + ... + k*k).

The second problem is checking if a string is a palindrome. It should have one parameter called str of type String. It should return true if the string is palindrome or false otherwise. For example:

Was it a car or a cat I saw? >>>>>>> A palindrome

A toy for a jar of tuna. >>>>>>>> Not a palindrome

Compare the running time of each different implementation of these methods and report your finding based on your observations. Use more data gradually and report if you see differences in the running time by timing your methods executions. You can use a table as follows:

Experiment

Palindrome

String Size

Iterative Palindrome

Recursive Palindrome

1

True

2

False

.

N

What to submit?

Two C++ classes, one for each problem. A write up of one page maximum; describing your experiments and results findings.

PLEASE READ THE PROBLEM CAREFULLY!!! I ONLY NEED HELP WITH THE CODING PART, NOTHING ELSE!!! PLEASE ANSWER IN C++!! WHOEVER ANSWERS THIS THANK YOU!!!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Neo4j

Authors: Gregory Jordan

1st Edition

1484200225, 9781484200223

Students also viewed these Databases questions

Question

1. What is the difference between exempt and nonexempt jobs?pg 87

Answered: 1 week ago

Question

Mantle Corporation is considering two equally risky investments

Answered: 1 week ago