Question: In C++ 1. A recursive function that sums from from 0 to n. (e.g., int sum(int n)) 2. A recursive function that computes base^exponent. (e.g.,

In C++ 1. A recursive function that sums from from 0 to n. (e.g., int sum(int n))

2. A recursive function that computes base^exponent. (e.g., 2^3 = 8). A possible function signature could be int power(int base, int exp)

3. A recursive function that return true if a string is palindrome. Namely, if a string reads from the beginning to end is the same as reading from the end to the beginning, then it is palindrome (e.g., abba, abcba are palindrome. abbc is not palindrome). Implement following classes and functions (Either C or C++ style is fine). Please note, it is better to practice on your own first. Do not refer to any material until getting stuck.

1. Node class that can store integer data and the address of next Node.

2. A Singly Linked List class that has the following functions:

a. Constructor

b. insertToFront: insert a new node at the beginning of linked list

c. deleteFromFront: delete the very first node from the linked list

d. printAll: print all the data of the linked list

e. insertToTail: insert a new node to the end of the linked list

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!