1
h09
CS16 M19-C
Name:
(as it would appear on official course roster)
Umail address: @umail.ucsb.edu section
Optional: name you wish to be called
if different from name above.
Optional: name of "homework buddy"
(leaving this blank signifies "I worked alone"

h09: Chapter 14: Recursion

ready? assigned due points
true Fri 08/16 11:00AM Wed 08/28 11:59PM

You may collaborate on this homework with AT MOST one person, an optional "homework buddy".

MAY ONLY BE TURNED IN IN THE LECTURE/LAB LISTED ABOVE AS THE DUE DATE,
OR IF APPLICABLE, SUBMITTED ON GAUCHOSPACE. There is NO MAKEUP for missed assignments;


Please:

  • No Staples.
  • No Paperclips.
  • No folded down corners.

Read Chapter 14 and the lecture notes. You don’t need to turn this homework in. To earn credit for this homework, complete the corresponding quiz on gauchospace AFTER you have completed the pen and pencil version of the homework. The quiz will be available at least one day before the due date indicated on the homework..

PLEASE MARK YOUR HOMEWORK CLEARLY, REGARDLESS OF IF YOU WRITE IT OUT IN INK OR PENCIL! FOR BEST RESULTS, SAVE THIS PAGE AS A PDF, THEN PRINT THE PDF.

1.(2 pts) How does a recursive function know when to stop recursing?

2.(3 pts) What is a LIFO scheme and how does it relate to stacks?

3.(3 pts) What is stack overflow?

4.(7 pts) Write a recursive function to find the sum of all the elements in a linked list. Use the definitions of LinkedList and Node from lab07

5.(12 pts) Write a recursive function program to find the nth element in the following numerical sequence: 1, 1, 2, 3, 5, 8, 13, 21, 34…

Hint: You first have to figure out what is the recursive pattern. You also have to identify the base case.

6.(15 pts) Write a recursive function to count the number of vowels in a string

7.(8 pts) Write a recursive function that counts the number of odd elements in a linked list.Use the definitions of LinkedList and Node from lab07