Starting from:

$29.99

CS104 Homework 08 Solution


1.Please implement a recursive function that checks whether an integer is palindrome or not. You are not allowed to convert the integer to a string. For example is_palindrome(121) returns True (assert is_palindrome(121)) and is_palindrome(123) returns False (assert not is_palindrome(123)) .
2.  The formula for Recaman’s sequence is as follows: Please implement a function that can print first n terms of Recaman sequence: 0, 1, 3, 6, 2, 7, 13, 20, 12, 21…

3.  Please see the linear_search.py and binary_search.py. Please give different values for n (10, 100, 1000, 10000, 1000000, 10000000) and value_to_look_for (give at least 10 random values) and measure the performance of each search. Create a table to report the performance and explain the outcome.
4.  Please implement the code for calculating the Golden Ratio (
1.618033988749894… ) by using a recursive method and a non-recursive method for Fibonacci numbers. Please time the execution of the programs and prepare a table showing n, the golden ratio calculated and also the execution times measured. Explain the relationship between n and the execution time of each program.

More products