A logistics analyst is using a bubble sort algorithm to arrange a batch of package weights, in kilograms, into ascending order. The initial unsorted list of weights is:
[14.2,5.8,12.1,19.5,3.4,8.9,11.0,7.3,15.6,2.1,9.4] [14.2, 5.8, 12.1, 19.5, 3.4, 8.9, 11.0, 7.3, 15.6, 2.1, 9.4] [14.2,5.8,12.1,19.5,3.4,8.9,11.0,7.3,15.6,2.1,9.4]State the number of comparisons made during the first pass of the algorithm.
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.