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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started