0
0
Intro to Computingfundamentals~10 mins

Algorithm efficiency basics (fast vs slow) in Intro to Computing - Draw & Compare

Choose your learning style9 modes available
Draw This - beginner

Draw a flowchart comparing two simple algorithms that find the largest number in a list of 5 numbers: Algorithm A checks each number one by one (slow), Algorithm B uses a method that compares pairs to reduce steps (faster). Show the steps and decisions clearly.

10 minutes
Hint 1
Hint 2
Hint 3
Hint 4
Hint 5
Grading Criteria
Start and End oval symbols present for both algorithms
Rectangles used for process steps
Diamonds used for decision points
Algorithm A shows checking each number sequentially
Algorithm B shows pairwise comparisons reducing steps
Flowchart paths lead to correct largest number result
Clear labeling of steps and decisions
Solution
Start
  |
  v
+-----------------------------+       +-----------------------------+
| Algorithm A: Check each num  |       | Algorithm B: Compare pairs   |
| 1. Set largest = first num   |       | 1. Compare num1 & num2       |
| 2. For each next number:     |       | 2. Keep larger of pair       |
|    - If number > largest     |       | 3. Compare num3 & num4       |
|      largest = number        |       | 4. Keep larger of pair       |
| 3. Compare largest with num5 |       | 5. Compare winner of pairs & num5 |
| 4. Result: largest           |       | 6. Result: largest number    |
+-----------------------------+       +-----------------------------+
  |                                         |
  v                                         v
 End                                       End

This flowchart shows two ways to find the largest number in a list of 5 numbers.

Algorithm A checks each number one by one. It starts by assuming the first number is the largest. Then it compares each of the other numbers to this largest value, updating it if a bigger number is found. This method requires 4 comparisons.

Algorithm B compares numbers in pairs to reduce the total comparisons. First, it compares the first two numbers and keeps the larger. Then it compares the next two numbers and keeps the larger. Finally, it compares the winner of these pairs with the last number to find the largest. This method uses fewer steps and is faster.

The flowchart uses ovals for start/end, rectangles for steps, and diamonds for decisions, making it easy to follow the logic.

Variations - 2 Challenges
[beginner] Draw a flowchart for finding the smallest number in a list of 7 numbers using a simple linear search (check each number one by one).
[intermediate] Draw a flowchart for finding the largest number in a list of 8 numbers using a divide-and-conquer approach (split list into pairs, find largest in each pair, then find largest among winners).