CSS 220 Module 6 Homework

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

  1. Selection Sort

  1. Bubble Sort

Short Answer

  1. We have a system running insertion sort and we find that it’s completing faster than expected. What could we conclude about the input to the sorting algorithm?

  1. 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]

  1. Find the smallest missing element from the following sorted list: [1, 2, 3, 5, 6, 7, 9]

  1. Count the number of occurrences of the number 7 in the following sorted list: [1, 2, 2, 2, 5, 7, 7, 7, 8, 9]

DETAILED ASSIGNMENT

20210302171016css220_homework6__3_

Powered by WordPress