Question: In this task, you will complete four recursive functions and trace them for some sample inputs. a . Create an HTML file that includes five
In this task, you will complete four recursive functions and trace them for some sample inputs.
a Create an HTML file that includes five buttons with the following labels: "recursive find A
"recursive find B "recursive find C "recursive palindrome", and "recursive count
asterisks". Create a div in your HTML to hold the results of calls to corresponding javascript
methods. You can style this page as you like. Feel free to use the HTML and CSS from prior
labs as a template, if you like.
b Create a JavaScript file that responds to clicks of these buttons. All implementations should
be recursive.
a Problem Create an array of random numbers that range between and
Then, write a function that will receive a number from the user and determine if
that number exists in the array or not.
For instance, assume the array is:
Now, assume the user enters the program should output true. But, if the user
enters the program should output false.
Approach:
We will be implementing this method in two different ways. Both will be recursive.
First, implement a method called indAxA where is the number we are looking
for and A is an array. In the body of the function, compare with the FIRST item that
is in the array. If this first item is equal to return true. If not, remove the first item
from A and call findA on the revised list. If you call find on an empty list, you
will want to return false.
Writing any explicit loop in your code results a for this question. Remember to provide
pre and postconditions. How many recursive calls will you need to search the entire
list?
Next, copy the following trace table in your word file and trace the input values to
the function fidin for when A and are initially
and respectively. As a guideline, we have populated the tables with the values for
the first calls and the corresponding returned values for each of those calls. Note
that in this example, the call numbers will be populated top down ie time elapses
from row to row while returned values are populated bottomup ie the
value in row is returned before the value in row You may want to use
console.log to observe these values when you write your solution.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
