Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

Like this presentation? Why not share!

2,523 views

Published on

No Downloads

Total views

2,523

On SlideShare

0

From Embeds

0

Number of Embeds

4

Shares

0

Downloads

167

Comments

0

Likes

1

No embeds

No notes for slide

- 1. Sorting: Question: How do you sort out data? a-z a-ZA-Z 0,1,2,3….. Looking For Patterns Question: Why do we sort out data? Answer: For effective analysis of data?
- 2. Common Sorting:
- 3. Insertion Sort Insertion sort is a simple sorting algorithm that builds the final sorted array (or list) one item at a time It is much less efficient on large lists than more advanced algorithms Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list Each iteration, insertion sort removes one element from the input data, finds the location it belongs within the sorted list Select Link here
- 4. Advantages / Disadvantages Advantages Disadvantages • Simple It is much less efficient on large lists • Efficient in practice than most other simple quadratic • Does not change the relative order of elements with equal key • Only requires a constant amount O(1) of additional memory space • Can sort a list as it receives it Least Advanced to other Algoritms
- 5. Best/Worst Array Best Array: The best case input is an array that is already sorted. In this case insertion sort has a linear running time (i.e., Θ(n)). During each iteration The first remaining element of the input is only compared with the right-most element of the sorted subsection of the array. Worst Array: The simplest worst case input is an array sorted in reverse order The set of all worst case inputs consists of all arrays where each element is the smallest or second-smallest of the elements before it. In these cases every iteration of the inner loop will scan and shift the entire sorted subsection of the array before inserting the next element.
- 6. Now for a Quiz!!!!!! Please read the set of questions and select the correct answers
- 7. Question 1 Complete the following sentence “Insertion Sort is...? a) “….a complex sorting algorithm” b) “… a simple sorting algorithm” c) “…the most efficient sorting algoritm”
- 8. Oh No Try Again! Or select to quit
- 9. Correct Answer!!!!! Well Done go to the next question
- 10. Question 2 How does Insertion operate? a) Builds the final sorted array (or list) one item at a time b) Builds the final sorted array (or list) in data batches c) Builds the final sorted array (or list) in reverse order
- 11. Correct Answer!!!!! Well Done go to the next question
- 12. Oh No Try Again! Or select to quit
- 13. Question 3 True or False “One of the advantages of Insertion is that it only requires a constant amount an additional memory space” True False
- 14. Correct Answer!!!!! Well Done go to the next question
- 15. Oh No Try Again! Or select to quit
- 16. Question 4 True of False, Insertion is most efficient on large lists? True False
- 17. Correct Answer!!!!! Well Done go to the next question
- 18. Oh No Try Again! Or select to quit
- 19. Question 5 The Best Array is… a) Data grouped in alphabetical order b) Data grouped in reverse order c) Data already sorted
- 20. Correct Answer!!!!! Well Done go to the next question
- 21. Oh No Try Again! Or select to quit

No public clipboards found for this slide

×
### Save the most important slides with Clipping

Clipping is a handy way to collect and organize the most important slides from a presentation. You can keep your great finds in clipboards organized around topics.

Be the first to comment