Answered step by step
Verified Expert Solution
Question
1 Approved Answer
this is in C++ (please clarify how where to include the functions in .h and .cpp etc) Coding exercise 1 Analyze the file lucas.cpp provided
this is in C++ (please clarify how where to include the functions in .h and .cpp etc)
Coding exercise 1 Analyze the file lucas.cpp provided in the assignment. It contains a recursive function to compute the nth Lucas number Using a Linux environment or your IDE, debug through the code2 in gdb3 to understand in what order the function lucas is called and with what parameters. In a file called Lucas.txt, list the function calls and returns in the order in which they were made when n7. Eg., when n-4, the list of function calls and returns is 1. Call lucas(4) 2. Call lucas(3) 3. Call lucas(2) 4. Returning 1 from lucas(2) 5. Call lucas(1) 6. Returning 2 from lucas(1) 7. Returning 3 from lucas(3) 8. Call lucas(2) 9. Returning 1 from lucas(2) 10. Returning 4 from lucas(4) Coding exercise 2 In a file called palindrome.txt, write the pseudocode to recursively check if a string is a palindrome or not. A palindrome is a string that reads the same backwards and forwards. E.g., racecar. In your implementation, you may assume that there are no spaces in the input string Once you have the pseudocode, write a function bool check_palindrome (const string &s) in a file called palindrome.cpp that implements the recursive algorithm you have written. Determine the computational complexity of your code and report it in palindrome.txt. Coding exercise 3 Extend your implementation of the arrayList template from Lab 3 to include a function called elemType getMin( that finds the smallest element in a list. Implement this function using recursion. Lucas txt #include
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