0% found this document useful (0 votes)
25 views

Data Structures & Algorithm

The document discusses various sorting algorithms, their properties, and how they work. It covers bubble sort, insertion sort, selection sort, merge sort, shell sort, quick sort, and heap sort. For each algorithm, it provides information on whether they are in-place, adaptive, and stable sorting algorithms. It also includes pseudocode and explanations for heap sort.

Uploaded by

Yu Hyakuya
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)
25 views

Data Structures & Algorithm

The document discusses various sorting algorithms, their properties, and how they work. It covers bubble sort, insertion sort, selection sort, merge sort, shell sort, quick sort, and heap sort. For each algorithm, it provides information on whether they are in-place, adaptive, and stable sorting algorithms. It also includes pseudocode and explanations for heap sort.

Uploaded by

Yu Hyakuya
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/ 46

DATA

STRUCTURES &
ALGORITHM
JNM
SORTING
ALGORITHMS
SORTING
SORTING
STABLE & NOT STABLE SORTING
STABLE & NOT STABLE SORTING
IMPORTANT TERMS
IMPORTANT TERMS
BUBBLE SORT ALGORITHM
BUBBLE SORT ALGORITHM
BUBBLE SORT ALGORITHM
BUBBLE SORT ALGORITHM
BUBBLE SORT ALGO PROPERTIES

• In-place sorting algorithm


• Adaptive sorting algorithm
• Stable sorting algorithm
INSERTION SORT ALGORITHM
INSERTION SORT ALGORITHM
INSERTION SORT ALGORITHM
INSERTION SORT ALGORITHM
INSERTION SORT ALGORITHM
INSERTION SORT ALGO PROPERTIES

• In-place sorting algorithm


• Adaptive sorting algorithm
• Stable sorting algorithm
SELECTION SORT ALGORITHM
SELECTION SORT ALGORITHM
SELECTION SORT ALGORITHM
SELECTION SORT ALGORITHM
SELECTION SORT ALGO PROPERTIES

• In-place sorting algorithm


• Non-Adaptive sorting algorithm
• Unstable sorting algorithm
MERGE SORT ALGORITHM
MERGE SORT ALGORITHM
MERGE SORT ALGORITHM
MERGE SORT ALGO PROPERTIES

• Not In-place sorting algorithm


• Non-Adaptive sorting algorithm
• Stable sorting algorithm
SHELL SORT ALGORITHM
SHELL SORT ALGO PROPERTIES

• In-place sorting algorithm


• Adaptive sorting algorithm
• Unstable sorting algorithm
QUICK SORT ALGORITHM

N
^2
QUICK SORT ALGORITHM
QUICK SORT ALGO PROPERTIES

• In-place sorting algorithm


• Non-Adaptive sorting algorithm
• Unstable sorting algorithm
HEAP SORT ALGORITHM
Heap sort is a comparison based sorting technique based on
Binary Heap data structure. It is similar to selection sort where we
first find the maximum element and place the maximum element at
the end. We repeat the same process for remaining element.

A Binary Heap is a Complete Binary Tree where items are stored


in a special order such that value in a parent node is greater(or
smaller) than the values in its two children nodes. The former is
called as max heap and the latter is called min heap. The heap can
be represented by binary tree or array. Average and worst case
complexity is O(n log n).
HEAP SORT ALGORITHM
Heap Sort Algorithm for Sorting in Increasing
Order:

1. Build a max heap from the input data.


2. At this point, the largest item is stored at the root of the heap.
Replace it with the last item of the heap followed by reducing
the size of heap by 1. Finally, heapify the root of tree.
3. Repeat above steps while size of heap is greater than 1.
Heap Sort Example
Heap Sort Algorithm Properties

1. In-place Sorting Algorithm


2. Adaptive Sorting Algorithm
3. Unstable Sorting Algorithm
DATA
STRUCTURES

You might also like