2.4 Practice Problems
To truly get a grasp of writing pseudocode and understanding flowcharts, it's essential to engage in practical exercises. Here are a few practice problems to help you solidify your understanding:
Problem 1
You are tasked to design an algorithm that prints out all the numbers from 1 to 100 that are divisible by 7.
Pseudocode solution:
Problem 2
Design an algorithm that checks whether a given word is a palindrome or not. A palindrome is a word that reads the same backward as forward, e.g., "level".
Pseudocode solution:
Problem 3
Design an algorithm that, given a list of numbers, finds the highest number in the list.
Pseudocode solution:
We recommend trying to draw flowcharts for these algorithms as well. This practice will solidify your understanding of how algorithms are represented graphically and will make you more comfortable with both forms of algorithm representation.
Remember, practice is the key to learning. By working through...