Presentation 2
Presentation 2
MAKAUT
DSA
(Sorting Techniques)
NAME : Subhradip Das
ROLL : 10201621078(Branch Change)
STERAM : Electronics and Communication Engineering
SEMESTER : 3rd
YEAR : 2nd
Content
Introduction to Sorting
Types of Sorting
Selection Sort
Insertion Sort
Bubble Sort
Quick Sort
Merge Sort
SORTING
• Sorting is a process in which records are arranged in
ascending or descending order
1 2 3 4 5 6
77 42 35 12 101 5
1 2 3 4 5 6
5 12 35 42 77 101
TYPES OF SORTING
• A divide-and-conquer algorithm:
• Divide the unsorted array into 2 halves until
the sub-arrays only contain one element
• Merge the sub-problem solutions together:
• Compare the sub-array’s first elements
• Remove the smallest element and put it
into the result array
• Continue the process until all elements
have been put into the result array
MergeSort Algorithm
Mergesort(Passed an array)
if array size > 1
Divide array in half
Call Mergesort on first half.
Call Mergesort on second half.
Merge two halves.
http://www.csanimated.com/animation.php?t=Quicksort
http://www.hakansozer.com/category/c/
http://www.nczonline.net/blog/2012/11/27/computer-science-in-javascript-quicksort/
http://www.sorting-algorithms.com/shell-sort