Skip to main content

Back to the full dot-point answer

SingaporeComputer ScienceQuick questions

Algorithms and Problem Solving

Quick questions on Bubble sort and insertion sort explained: H2 Computing

5short Q&A pairs drawn directly from our worked dot-point answer. For full context and worked exam questions, read the parent dot-point page.

What is bubble sort?
Show answer
Bubble sort repeatedly walks the list comparing adjacent pairs and swapping any that are out of order. After each full pass the largest remaining element has "bubbled" to its correct place at the end:
What is insertion sort?
Show answer
Insertion sort builds a sorted region at the front, taking each new element and shifting it left into place:
What is q1?
Show answer
After one full pass of bubble sort, what is guaranteed about the list? [1 mark]
What is q2?
Show answer
State the best-case complexity of insertion sort and the input that produces it. [2 marks]
What is q3?
Show answer
Why is insertion sort preferred over bubble sort for nearly sorted data? [2 marks]

Have a question we have not covered?

This dot-point answer is short enough that we have not extracted many short questions yet. Read the full dot-point answer or ask Mo, our study assistant, in the chat for follow ups.

All Computer ScienceQ&A pages