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?...
Common Sorting:
Insertion Sort
 Insertion sort is a simple sorting algorithm
that builds the final sorted array (or list)
one item at a t...
Advantages / Disadvantages
Advantages Disadvantages
• Simple It is much less efficient on
large lists
• Efficient in pract...
Best/Worst Array
Best Array:
 The best case input is an array that is already sorted.
 In this case insertion sort has a...
Now for a Quiz!!!!!!
Please read the set of questions and select
the correct answers
Question 1
Complete the following sentence “Insertion
Sort is...?
a) “….a complex sorting algorithm”
b) “… a simple sortin...
Oh No Try Again!
Or select to quit
Correct Answer!!!!!
Well Done go to the next question
Question 2
How does Insertion operate?
a) Builds the final sorted array (or
list) one item at a time
b) Builds the final s...
Correct Answer!!!!!
Well Done go to the next question
Oh No Try Again!
Or select to quit
Question 3
True or False
“One of the advantages of Insertion is that it
only requires a constant amount an
additional memo...
Correct Answer!!!!!
Well Done go to the next question
Oh No Try Again!
Or select to quit
Question 4
True of False, Insertion is most efficient on
large lists?
True False
Correct Answer!!!!!
Well Done go to the next question
Oh No Try Again!
Or select to quit
Question 5
The Best Array is…
a) Data grouped in alphabetical
order
b) Data grouped in reverse order
c) Data already sorted
Correct Answer!!!!!
Well Done go to the next question
Oh No Try Again!
Or select to quit
Insertion sort
Insertion sort
Insertion sort
Upcoming SlideShare
Loading in...5
×

Insertion sort

1,235

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,235
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
65
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Insertion sort

  1. 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. 2. Common Sorting:
  3. 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. 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. 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. 6. Now for a Quiz!!!!!! Please read the set of questions and select the correct answers
  7. 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. 8. Oh No Try Again! Or select to quit
  9. 9. Correct Answer!!!!! Well Done go to the next question
  10. 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. 11. Correct Answer!!!!! Well Done go to the next question
  12. 12. Oh No Try Again! Or select to quit
  13. 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. 14. Correct Answer!!!!! Well Done go to the next question
  15. 15. Oh No Try Again! Or select to quit
  16. 16. Question 4 True of False, Insertion is most efficient on large lists? True False
  17. 17. Correct Answer!!!!! Well Done go to the next question
  18. 18. Oh No Try Again! Or select to quit
  19. 19. Question 5 The Best Array is… a) Data grouped in alphabetical order b) Data grouped in reverse order c) Data already sorted
  20. 20. Correct Answer!!!!! Well Done go to the next question
  21. 21. Oh No Try Again! Or select to quit
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×