Activity Card - Optimize Nested Loops

Optimize Nested Loops

Objective: Students will optimize nested loops for better performance.

Instructions:

  1. Provide programs with inefficient nested loops.
  2. Students rewrite the loops to reduce unnecessary iterations.
  3. Compare the performance of the original and optimized versions.

Materials:

Assessment: