RG's E-Learning Centre · Book a free demo class · WhatsApp +91-9379416374

Bubble sort passes: Class 11 practice

Bubble sort compares neighbours and swaps them if they are in the wrong order. The quick answer and an example come first; then the method, worked examples and six graded questions.

Bubble sort passes: quick answer

Bubble sort compares neighbours and swaps them if they are in the wrong order. After pass k, the k largest values are in their final places at the end.

Example: Apply 1 pass of bubble sort (ascending) to [13, 25, 21, 23, 51]. Give the list and the number of swaps. Answer: [13, 21, 23, 25, 51], 2 swaps.

  • Where it is taught: "Sorting", Class 11 Computer Science.
  • On this page: the method, 3 worked examples and 6 graded questions with a full answer key.

How to use this page (about 30 minutes)

  1. Read the method once, then cover the worked examples and try them yourself before reading the steps.
  2. Do the two Basic questions without notes. If either is wrong, re-read the matching worked example.
  3. Do the Standard and Challenge questions, then check every line of working against the answer key — not only the final answer.
  4. Write down the mistake behind each wrong answer and redo that question the next day.

What you should know first

  • Lists

The idea behind bubble sort passes

Bubble sort compares neighbours and swaps them if they are in the wrong order. After pass k, the k largest values are in their final places at the end.

Step-by-step method

  1. Compare positions 0–1, 1–2, … swapping when left > right.
  2. One full sweep is a pass.
  3. Repeat; stop early if a pass makes no swaps.

Worked example 1 (Basic)

Apply 1 pass of bubble sort (ascending) to [13, 25, 21, 23, 51]. Give the list and the number of swaps.

  1. After 1 pass(es): [13, 21, 23, 25, 51]
  2. Swaps: 2
  3. Answer: [13, 21, 23, 25, 51], 2 swaps

Worked example 2 (Standard)

Apply 2 passes of bubble sort (ascending) to [32, 39, 34, 53, 7, 42]. Give the list and the number of swaps.

  1. After 2 pass(es): [32, 34, 7, 39, 42, 53]
  2. Swaps: 4
  3. Answer: [32, 34, 7, 39, 42, 53], 4 swaps

Worked example 3 (Challenge)

Apply 3 passes of bubble sort (ascending) to [14, 3, 59, 46, 23, 5, 13]. Give the list and the number of swaps.

  1. After 3 pass(es): [3, 14, 5, 13, 23, 46, 59]
  2. Swaps: 10
  3. Answer: [3, 14, 5, 13, 23, 46, 59], 10 swaps

Common mistakes and misconceptions

  • Thinking one pass sorts the list
  • Forgetting the last k items are already fixed

Practice questions

  1. (Basic) Apply 1 pass of bubble sort (ascending) to [27, 34, 30, 50, 58]. Give the list and the number of swaps.
  2. (Basic) Apply 1 pass of bubble sort (ascending) to [14, 1, 46, 14, 12]. Give the list and the number of swaps.
  3. (Standard) Apply 2 passes of bubble sort (ascending) to [49, 9, 38, 20, 29, 55]. Give the list and the number of swaps.
  4. (Standard) Apply 2 passes of bubble sort (ascending) to [60, 41, 5, 32, 42, 17]. Give the list and the number of swaps.
  5. (Challenge) Apply 3 passes of bubble sort (ascending) to [12, 44, 51, 23, 16, 34, 28]. Give the list and the number of swaps.
  6. (Challenge) Apply 3 passes of bubble sort (ascending) to [13, 23, 5, 28, 40, 6, 14]. Give the list and the number of swaps.

Answer key with full working

  • Q1: After 1 pass(es): [27, 30, 34, 50, 58] → Swaps: 1 → Answer: [27, 30, 34, 50, 58], 1 swaps
  • Q2: After 1 pass(es): [1, 14, 14, 12, 46] → Swaps: 3 → Answer: [1, 14, 14, 12, 46], 3 swaps
  • Q3: After 2 pass(es): [9, 20, 29, 38, 49, 55] → Swaps: 6 → Answer: [9, 20, 29, 38, 49, 55], 6 swaps
  • Q4: After 2 pass(es): [5, 32, 41, 17, 42, 60] → Swaps: 8 → Answer: [5, 32, 41, 17, 42, 60], 8 swaps
  • Q5: After 3 pass(es): [12, 16, 23, 28, 34, 44, 51] → Swaps: 10 → Answer: [12, 16, 23, 28, 34, 44, 51], 10 swaps
  • Q6: After 3 pass(es): [5, 13, 6, 14, 23, 28, 40] → Swaps: 8 → Answer: [5, 13, 6, 14, 23, 28, 40], 8 swaps

Which textbook this practice follows

This skill is taught under "Sorting" in Class 11 Computer Science. Check your own textbook's contents page — CBSE, ICSE/ISC and state boards order chapters differently.

Answers on this page are generated and automatically re-checked by a second, independent calculation. They have not been reviewed by a teacher — if you spot a problem, tell us on WhatsApp.

Still stuck after the answer key?

If the same step in bubble sort passes keeps going wrong, a short live 1 on 1 class can find the exact gap. The first demo class is free; send the class, board and chapter on WhatsApp (+91 9379416374).

Related practice and notes

More Class 11 Computer Science practice

Continue with this syllabus

Frequently asked questions

Which chapter is bubble sort passes in?

This skill is taught under "Sorting" in Class 11 Computer Science. Check your own textbook's contents page — CBSE, ICSE/ISC and state boards order chapters differently.

Which question should I start with?

Start with the Basic questions. Move to Standard only when both Basic answers match the key with the same working; the Challenge questions combine this skill with earlier ones.

How were the answers checked?

Answers on this page are generated and automatically re-checked by a second, independent calculation. They have not been reviewed by a teacher — if you spot a problem, tell us on WhatsApp.

Is this only for CBSE?

The skill names follow NCERT/CBSE, but the method is the same for ICSE, state boards, IGCSE and IB. Only the chapter name and order differ.

Can I get live help with this topic?

Yes. RG's E-Learning teaches live 1 on 1 online classes; the first demo class is free and fees are shared after it.

Book a free demo class