Computer Science Homework Help
Develop a sorting algorithm. Your sorting algorithm may only be an implementation of a the shellsort, mergesort, or quicksort. Your algorithm must use an array of integers of at least 20 different ite
Develop a sorting algorithm. Your sorting algorithm may only be an implementation of a the shellsort, mergesort, or quicksort. Your algorithm must use an array of integers of at least 20 different items. The items in the list must be in a random order. You algorithm must sort the list using the sorting algorithm that you have chosen and keep track of the number of exchanges that are required to sort the list. This value along with the contents of the sorted list must be displayed as output to the algorithm to the console.
The following algorithm implements a sorting algorithm that meets the requirements of this assignment with the exception of the fact that it sorts the list using an insertion sort. The insertion sort is an example of a ‘brute force’ algorithm. A brute force algorithm is one that solves a problem in a simple way by computing every possible step. As you run this algorithm you will see how a item is often moved many times until it finds the right place and then the same thing is done with the next item. It isn’t very elegant, it works, but it does a LOT OF WORK and is not very efficient. We will define ‘Brute Force’ in more detail in CS1304. You can copy this code into the Jeliot tool to understand the output that will be required in your algorithm and the operation of a Brute Force Insertion sort algorithm.
# Insertion sort algorithm