0% found this document useful (0 votes)
22 views38 pages

L28 Sorting Algorithms

The document discusses the Insertion Sort and Selection Sort algorithms, detailing their complexities. Insertion Sort has a best case of O(n), while Selection Sort consistently has a complexity of O(n²) for all cases. Additionally, it notes the efficiency of data shifting in Insertion Sort compared to Selection Sort.

Uploaded by

charusahu53
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views38 pages

L28 Sorting Algorithms

The document discusses the Insertion Sort and Selection Sort algorithms, detailing their complexities. Insertion Sort has a best case of O(n), while Selection Sort consistently has a complexity of O(n²) for all cases. Additionally, it notes the efficiency of data shifting in Insertion Sort compared to Selection Sort.

Uploaded by

charusahu53
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 38

Illustration

Ascending order
Insertion Sort
Algorithm
Complexity of
Insertion Sort
Best Case O(n)

Worst Case O (n2 )

Average Case O (n ) 2
For both assignment
& comparision
It Reduces
the Amount of
Data Shifting
Complexity of
Selection Sort

Best Case O (n2 )

Worst Case O (n2 )

Average Case O (n2 )


Selection Sort
O(n) for assignment
with a PC of 1.5

O(n2 ) for Comparision


with a PC of 0.5

You might also like