A network router's buffer management utility uses a bubble sort algorithm to organize a log of incoming packet sizes (in megabytes) into ascending order.
The list of packet sizes to be sorted is:
4.2,1.8,3.5,0.9,5.1,2.2,3.8 4.2, \quad 1.8, \quad 3.5, \quad 0.9, \quad 5.1, \quad 2.2, \quad 3.8 4.2,1.8,3.5,0.9,5.1,2.2,3.8State the condition that determines when the bubble sort algorithm has completed and can terminate.
159 exam-style questions on Edexcel GCSE Computer Science Algorithms, covering Constructs for solving problems, Variables, constants and data structures, Arithmetic, relational and logical operators, Tracing algorithm output with trace tables, Types of error and correcting logic errors, Standard algorithms (sorts and searches), and Evaluating algorithm fitness and efficiency. Each one has a worked solution and a mark scheme showing where the marks go.