Unless specified all sort algorithms order elements in ascending order.
  1. Implement the selection sort algorithm for the array and indicate the results in parts A and D.
    7	3	0	8	1
    [0]	[1]	[2]	[3]	[4]
    
    1. How many passes are required for the sort?_____
      1. 4
      2. 5
      3. 6
      4. 3
    2. After pass 1, list the elements in their given order____
    3. In pass 2 which element is selected?______. Which 2 array items are exchanged?________and_______
    4. After pass 3 the elements in their given order___________
    1. How many comparisions are required to order an array of 5 elements using the selection sort?
      1. 10
      2. 15
      3. 20
      4. 30
    2. For a 5 element list the number of comparisions in a selection sort becomes___ if the list is already sorted?
      1. 0
      2. 10
      3. 1
      4. 20
    3. For a 5 element list the number of comparisions in a selection sort becomes___ if the list is already sorted in reverse order?
      1. 0
      2. 10
      3. 1
      4. 20
    4. What is the maximum number of exchanges required to order an array of 5 elements using the selection sort?_____
    1. What is the average case computational complexity of the selection sort?
      1. O(n log2n)
      2. O(n2)
      3. O(n)
      4. O(n3)
    2. There is no difference between the best and worst case effeciency for the selection sort?
      1. true
      2. false
  2. Use the bubble sort to order the following array. After each pass 1 through 3, list the elements in their given order and give the current value of "lastExchangeIndex".
    7	12	3	0	8	10	1
    [0]	[1]	[2]	[3]	[4]	[5]	[6]
    Pass 1: lastExchangeIndex_____ List: ______
    
    Pass 2: lastExchangeIndex_____ List: ______
    
    Pass 3: lastExchangeIndex_____ List: ______
    
         
    1. What is the average case computational complexity of the bubble sort?
      1. O(n log2n)
      2. O(n2)
      3. O(n)
      4. O(n3)
    2. There is no difference between the best and worst case efficiency for the bubble sort?
      1. true
      2. false
    3. What is the computational complexity for the bubble sort when handling the best case?
      1. O(n log2n)
      2. O(n2)
      3. O(n)
      4. O(n3)
  3. Implement the insertion sort algorithm for the array
    7	3	0	8	1
    [0]	[1]	[2]	[3]	[4]
    
    1. How many passes are required for the sort?____
    2. Trace the first three passes and list the elements in their given order
      Pass 1:  List: ______
      
      Pass 2:  List: ______
      
      Pass 3:  List: ______
      
    1. In the best case what is the number of comparisions to order an array of 5 elements using the selection sort?_____
      1. 1
      2. 4
      3. 7
      4. 10
    2. In the worst case what is the number of comparisions to order an array of 5 elements using the insertion sort?
      1. 4
      2. 10
      3. 15
      4. 20
  4. What is the computational complexity of the insertion sort for
    1. The average case
      1. O(n log2n)
      2. O(n2)
      3. O(n)
      4. O(1)
    2. The worst case_____
      1. O(n log2n)
      2. O(n2)
      3. O(n)
      4. O(1)
    3. The best case
      1. O(n log2n)
      2. O(n2)
      3. O(n)
      4. O(1)
  5. Use the quickest sort algorithm on the following 10 element array.
    90	55	65	80	20	5	60	100
    [0]	[1]	[2]	[3]	[4]	5[]	[6]	[7]
    
    1. In pass 1 what is the pivot value?_____
    2. In pass 1 indicate all pairs of elements that must be exchanged to move to their proper sublist
    3. At which index in the array is the pivot inserted?
    4. List the items in order after pass 1
    1. Record the elements in the sublist after pass 1 in 14.9. (Note the sublist may have fewer than 7 elements)
      ___	___	___	___	___	___	___
      
      [0]	[1]	[2]	[3]	[4]	[5]	[6]
      
    2. Use the Quicksort algorithm to complete a pass on this sublist. Give the ordering of these elements.
  6. The Quicksort algorithm uses recursion to sort both lower and upper sublists. In the recursive algorithm describe the stopping condition____
  7. Which situation represents the worst case for the Quicksort?
    1. The elements in ascending order
    2. The elements in descending order
    3. The pivot is the smallest element all of the time.
    4. The elements are in alternating small/large order.
  8. Which situation represents the best case for the Quicksort?
    1. The elements in ascending order
    2. The pivot is the smallest element all of the time.
    3. The elements are in random order
    4. The elements are in alternating small/large order.
  9. What is the computational complexity for the Quicksort for
    1. The average case_______
      1. O(n log2n)
      2. O(n2)
      3. O(n)
      4. O(1)
    2. The worst case_____
      1. O(n log2n)
      2. O(n2)
      3. O(n)
      4. O(1)
    3. The best case_____
      1. O(n log2n)
      2. O(n2)
      3. O(n)
      4. O(1)
  10. Which of the basic sort algorithms is most efficient when the list is initially ordered?
    1. selection
    2. insertion
    3. bubble
    4. ambiguous
  11. Which of the basic sort algorithms is most efficient when the list is initially given in reverse order?
    1. selection
    2. insertion
    3. bubble
    4. ambiguous