Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write each of the three algorithms: Be sure to comment your code to let me know

ID: 3543716 • Letter: W

Question

Write each of the three algorithms:

Be sure to comment your code to let me know that you understand each of the methods.

Generate a random array or integers of the sizes 10; 100; 1,000; 10,000; 100,000; and 1,000,000.  Time how long each of the above algorithms take (if you're using C, think ctime.h - each language has it's own timer function -- Google is helpful).

Write a brief overview comparing the times and choosing which of the sorting algorithms is best (We'll return to discuss a lot of this later in class). Include in the Zip File the .c files for the algorithms and the write up.

Explanation / Answer

Bubble sort


The insertion sort only passes through the array once. Therefore it is a very fast and efficient sorting algorithm with small arrays. (The efficiency is lost however with large amounts of data.)

The sort works as follows: the array is split into two (virtual) sub-arrays. (With virtual I mean that the array is not really split.) The first sub-array is considered to be the

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote