CSS 220 Module 6 Homework
Step by Step Sorting
Show the steps taken by each sort on the following unordered list of integers (duplicate items are denoted with letters):
4, 1, 6, 8, 9, 2, 3
1. Insertion Sort
2. Selection Sort
3. Bubble Sort
Short Answer
1. We have a system running insertion sort and we find that its completing faster than expected. What could we conclude about the input to the sorting algorithm?
2. Give a 5-element array such that it elicits the worst-case runtime for bubble sort.
Python Programming
Submit a Python file for each of the following. Do not use prebuilt Python functions/methods. These should be solved using loops and comparisons.
1. Find the smallest and largest numbers in the following unsorted list: [4, 2, 7, 3, 8, 5]
2. Find the smallest missing element from the following sorted list: [1, 2, 3, 5, 6, 7, 9]
3. Count the number of occurrences of the number 7 in the following sorted list: [1, 2, 2, 2, 5, 7, 7, 7, 8, 9]