🧠Concept

Pick the right answer.

Concept · Q1
What is bubble sort?
Concept · Q2
A list has 5 items. How many passes does the outer loop of bubble sort run?
Concept · Q3
A student tries to swap items 2 and 3 in a list using only these two blocks, with no temp variable:
Concept · Q4
After 3 complete passes of bubble sort on a list of 6 items, what is guaranteed to be in the correct final position?

👀Code Reading

Look at the blocks. Predict what happens.

Code Reading · CR1
What does this code do?
set [temp v] to (item (i) of [nums v])
replace item (i) of [nums v] with (item ((i) + (1)) of [nums v])
replace item ((i) + (1)) of [nums v] with (temp)
Code Reading · CR2
What does the inner loop of this bubble sort implementation do?
set [i v] to (1)
repeat ((length of [nums v]) - (1))
  if <(item (i) of [nums v]) > (item ((i) + (1)) of [nums v])> then
    set [temp v] to (item (i) of [nums v])
    replace item (i) of [nums v] with (item ((i) + (1)) of [nums v])
    replace item ((i) + (1)) of [nums v] with (temp)
  end
  change [i v] by (1)
end
Code Reading · CR3
A list is [3, 1, 4, 2]. After one complete pass of bubble sort (comparing all adjacent pairs), what does the list look like? Trace the pass step by step:

🐛Find the Bug

Something is broken. Pick the fix.

This swap is supposed to exchange items at position i and i+1 in the list. After running, both items end up with the same value. What is the bug?

replace item (i) of [nums v] with (item ((i) + (1)) of [nums v])
replace item ((i) + (1)) of [nums v] with (item (i) of [nums v])

🛠️Build It

Pick a level. Build it. Check the boxes.

🧑‍🏫
For the teacher

Review the student's project, then check each thing they did.

Project Evaluation

0 of 4 ticked

💬Talk About It

Present your project to your teacher or a classmate.

  1. 1️⃣Show your swap project and point to temp.
  2. 2️⃣Use two numbers (for example 3 and 5): say what goes wrong without temp, then say the three steps of the correct swap.
🧑‍🏫
For the teacher

Watch the student present, then check each thing they did.

Presentation Checklist

0 of 3 ticked

📤Submit

Send your results to your teacher and parent.

0 of 0 answered