For Thursday
Watch Dynamic Classes video
Prerequisite knowledge:
C++ Pointers
Dynamic Memory Management in C++
Classes in C++
Overloading Operators
Submit Homework HW 1 on Recursion (Postponed to Wednesday)
Getting to Know You
Introduce yourself on Teams in the appropriate channel by Wednesday. Include
why you chose computer science and something you like to do for fun.
Be sure to check out the other introductions and even respond to them.
If you get stuck or confused
Come
Use
Come
Send
Do not struggle
Realize
Come for help early
Use Teams to reach out to me
Come to office hours
Send email
Not
Geeks4Geeks,
StackExchange,
GitHub, etc
Do not struggle alone
Realize that you can get help from your friends and me
Learning Together
Help each other in class
Help each other with concepts
I have provided Teams for a reason
Work together on your homework
In groups of up to 4 people
Complete your programs and exams by yourself except that you are
encouraged to reach out to me for help on the programs.
Using C++ on the Linux Machines
Use the guide available on Canvas
Recommended editor: Visual Studio Code
Install the Live Share extension
We are not using an IDE; we will compile from the command line
Use g++ for compilation
NearPod Collaborate Board
Our Focus
Functionality
Correct
Algorithm/Data
Structure Use
Program and
Class Design
Code Clarity
Minor Focus on
Usability
Minor Focus on
Efficiency
Recursion
What is it?
How does it work?
Weiss's 4 Rules of Recursion
Recursive Power Function
See Nearpod (use 6 for initial argument)
int func1(int num)
{
if(num < 5)
return 12;
else
return func1(num-1)+3;
}
Calculating Greatest Common Divisor
Let's write the recursive int gcd(int num1, int num2) in C++
What is the base case?
When num1 and num2 are different, their GCD is the same as the GCD of the
smaller number and their difference
Assume that num1 and num2 are positive integers
Recursive
Palindrome Checker