Advertisement
Guest User

Untitled

a guest
Feb 27th, 2020
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. 1. There is a very small difference between the selection sort and insertion sort sort times for arrays of this size, simply because there can't be that much of a difference in execution counts, as there are only 10 indices.
  2.  
  3. 2. There is a very large difference in runtime for both reverse and almost sorted between insertion and selection sort. The execution count for insertion sort is much less on almost sorted than it is for selection sort because the while loop just moves over the indices which don't need to be sorted, while selection sort has to consider every value. The opposite is true for the reverse array, where selection sort has a much smaller execution count compared to insertion sort, which has to consider every value in the reverse array.
  4.  
  5. 3. I think selection sort is much more intuitive, but I like insertion sort more, because the way it works is very interesting to me.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement