Logistics:
Quiz will be on Blackboard for first 5 minutes DONOT BE LATE
You will attempt the lab in Zybooks Chapter 10.10
Password will be given by the TA
The TAs will assign you to breakout rooms of 3 people each
Follow the links below to collaborate with your team mates.
(These slides have group numbers and also have google hangout link if you need to talk and Blackboard doesn't cooperate)
8am 9am 10am 11am 12pm 1pm 2pm 3pm 4pm 5pm.
When you are done raise your hand and we will come and grade you.
Please do not leave without getting graded.
Recursion in simple terms is "Re - occur". So far you have written loops and executed iterative programs.
In this lab you will take functions that work non-recursively (iteratively), and you will rewrite them to work recursively.
(Please go through Zybooks Chapter 10 on Recursion for this lab):
Three properties of recursive functions:
Recursive functions do not have loops
They call themselves
Have an exit condition so they can stop calling themselves.
You have been given an example of how an iterative code could be converted into recursive. Look at sampleIterative and sampleRecursive for reference
Running this program looks like:
Enter the limit: 5
0 1 2 3 4
0 1 2 3 4
You have two different iterative functions that need to be converted into recursive functions.
This lab has no automated checks, please let the TAs know and they will grade you.
All two recursive functions return an integer, and take parameters as indicated in main().
Stage 1: Display odd numbers smaller than some number (2 Point)
You have been given the reference iterative function problemOneOddNumbersIterative , this function takes a number as input and displays all the odd numbers smaller than this number.
You are to write the function that does exactly the same thing but recursively.
Stage 2: Count the number of upper case alphabets (1 Point: Extra Credit)
You have been given the reference iterative function problemTwoCountUpperRecursive , this function takes a string as input and counts the number of upper case alphabets in it. You are to write the function that does exactly the same thing but recursively.