Return to Index
Inheritance : 07/05/2022
Data Modeling 1 : 07/05/2022
Static : 07/01/2022
Encapsulation : 07/01/2022
Constructors : 06/30/2022
Objects, Continued : 06/30/2022
Introduction to Objects : 06/29/2022
Compilation and Type Inference : 06/29/2022
Practice with Collections : 06/28/2022
Maps and Sets : 06/28/2022
Lists and Type Parameters : 06/27/2022
Imports and Libraries : 06/27/2022
Multidimensional Arrays : 06/24/2022
Practice with Strings : 06/24/2022
null : 06/23/2022
Algorithms and Strings : 06/23/2022
Strings : 06/22/2022
Functions and Algorithms : 06/22/2022
Practice with Functions : 06/21/2022
More About Functions : 06/21/2022
Errors and Debugging : 06/20/2022
Functions : 06/20/2022
Practice with Loops and Algorithms : 06/16/2022
Algorithms I : 06/16/2022
Loops : 06/15/2022
Arrays : 06/15/2022
Compound Conditionals : 06/14/2022
Conditional Expressions and Statements : 06/14/2022
Operations on Variables : 06/13/2022
Variables and Types : 06/13/2022
Welcome to CS 124 : 06/13/2022
Functions and Algorithms
Java
Created By: Geoffrey Challen
/ Updated: 2022-05-26
Functions are so important that we're going to continue getting more practice with them.
We'll also discuss the connection between functions and algorithms, the conceptual heart of computer science.
Throughout this lesson we'll return to bits of code that we previous implemented as snippets and reimplement them as methods.
We'll also use this as a chance to reinforce some important programming patterns that we've already been using.
Debugging Challenge
But let's start with some debugging practice!
Array Search
Next, let's revisit the code we wrote for array search, rewrite it is a method, and then test it using some sample inputs.
Reimplement array search, wrap in a method, and then test.
Interactive Walkthrough
Click on an icon below to start!
Array Is All Larger
Our next practice problem has a tricky loop setup.
Let's review that together, and then you can attempt the problem itself.
Get students started on the practice problem.
Make sure to discuss the difference between the playground and the homework environment.
Interactive Walkthrough
Click on an icon below to start!
Show how to complete the homework problem above. Feel free to cover multiple approaches!
Array Sum
Now, let's revisit the code we wrote for array sum, rewrite it is a method, and then test it using some sample inputs.
Reimplement array sum, wrap in a method, and then test.
Interactive Walkthrough
Click on an icon below to start!
Catchup Quiz Grading
As a bit of homework preparation support, let's talk through how to approach this lesson's homework problem, since it has another interesting loop setup.
We'll also demonstrate how we can modify the values of arrays that are passed to methods.
Get students started on the homework problem.
Demonstrate how methods can modify the values of arrays that are passed to them.
Interactive Walkthrough
Click on an icon below to start!
Show how to complete the homework problem above. Feel free to cover multiple approaches!