Question: 1. Consider the list of characters: ['P',Y,T,'H','O','N']. For the bubble sort algorithms a) Show how this array appears after the second pass of the
1. Consider the list of characters: ['P',Y,T,'H','O','N']. For the bubble sort algorithms a) Show how this array appears after the second pass of the outer loop b) How many comparisons did it make during the second pass of the outer loop c) How many swaps did it make during the second pass of the outer loop d) How many comparisons did it make after the second pass of the outer loop e) How many swaps did it make after the second pass of the outer loop f) How many comparisons did it make to sort the array? g) How many swaps did it make to sort the array? 2. Consider the following list of integers: 33, 22, 44, 55, and 11 in an array. For the insertion sort algorithm a) Show how this array appears after the first pass of the outer loop b) Show how this array appears after the first pass of the inner loop during the third pass of the outer loop
Step by Step Solution
3.52 Rating (145 Votes )
There are 3 Steps involved in it
1 Bubble Sort List P Y T H O N a After the second pass of the outer loop The list will look like thi... View full answer
Get step-by-step solutions from verified subject matter experts
