Computer Programming: Key Concepts
Algorithms
What are they?
A repeatable process for determining the solution to a problem.
function transportationOptions() {
// Write code here to make this decision tree into an algorithm!
}
Algorithms in Daily Life
- Finding a fruit in the grocery store.
- Alphabetizing name tags.
-
Re-organizing your kitchen to make finding stuff easier.
- Finding keys that you lost.
- Finding something good to watch on TV.
- Washing your car windows.
These are all things that we can repeat over and over again!
Create your own algorithm
Design an algorithm for doing the laundry.
More on Algorithms: Your Brain and Your Computer
Click
here
for more info on different types of algorithms as well as linear and
binary search
Click
here for more on binary search!
Problem-Solving Method
-
Understand the problem.
- Read or listen to the problem statement.
- What is the input?
- What is the output?
-
Make a plan to solve the problem.
-
Use pictures, charts, graphs, systematic lists, objects.
- Act out the solution to help you devise a plan.
- In Computer Science, we call this plan an algorithm.
-
Carry out the plan.
- Once the plan is conceived and understood, follow it.
- If you have planned well, this is the easy part.
-
Review and reflect on how the problem was solved — once the
problem is solved, reflect on the plan that was used.
The Importance of Pseudocoding
To pseudocode is to write out the steps of solving a problem in
plain language (before you start writing any code).
More on Pseudocoding
Watch
this!
Pseudocoding Steps
-
Make sure you fully understand the problem.
- Look up any tools you might need.
-
Write down the inputs and outputs of the function.
-
List out the coding structures you might use (loops, variables,
conditional statements).
-
Write comments describing what you are going to do.
- Look it over and then write the code!
Exercise!
Flex your algorithm muscles!
THE END
Thank you for your attention!