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?
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”
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
Be the first to comment