SlideShare a Scribd company logo
SORTINGSORTING
Presented By - Ashin Guha Majumder
(Roll 551)
Sorting means arranging
elements of an array so
that they are placed in
some relevant order
which may either be
ascending or descending.
This order can be
numeric, lexicographic or
any other user defined
type.
An internal sort is any
data sorting process that
takes place entirely
within the main
memory of a computer.
This is possible
whenever the data to be
sorted is small enough
to all be held in the main
memory.
External sorting is
required when the data
being sorted do not fit
into the main memory of
a computing device
(usually RAM) and
instead they must reside
in the slower external
memory (usually a hard
drive).
What is Sorting ?
• How do we find the people who most
like us on … Amazon, Netflix,
Facebook..……Need a metric for
analyzing closeness/nearness - Need to
find people "close", sorting helps
• How does Google find matching web
pages?
• How does SoundCloud find your song?
• How does instagram find your image?
• Sorting to the rescue !
Sorting in General
• How do you search in a "real"
dictionary?
• How would a DICTIONARY be which
is not arranged in alphabetical order ?
• Oxford English Dictionary contains
full entries for 171,476 words in
current use
• No sequence – you might find the
required word in the first page(Best
Case) / an intermediate page(Average
Case) / the last page(Worst Case)
• Time required would be huge. So
definitely an arranged order would
help a lot !
• Hence we need sorting especially for
asymptotic amounts of data!
Workers sorting parcels in a postal facility
Workers sorting parcels in a postal
facility
A railroad classification yard, used
for sorting freight cars
Theory of the Asymptotic Notation
Radix sort is a non-comparative integer sorting algorithm
that sorts data with integer keys by grouping
keys by the individual digits which share
the same sigRadix sort is a
non-comparative integer sorting algorithm
that sorts data with integer keys by grouping
keys by the individual digits which share
the same significant position and value.
A positional notation is required,
but because integers can represent
strings of characters (e.g., names or dates)
and specially
formatted floating point numbers,
radix sort is not limited to integers.
12 58 37 64 52 36 99 63 18 9 20 88 47
20
12
52 63 64 36
37
47
58
18
88
9
99
20 12 52 63 64 36 37 47 58 18 88 9 99
9 12 18 20 36 37 47 52 58 63 64 88 99
9
12
18 20
36
37 47
52
58
63
64 99
20 12 52 63 64 36 37 47 58 18 88 9 99
88
12 58 37 64 52 36 99 63 18 9 20 88 47
20 12 52 63 64 36 37 47 58 18 88 9 99
9 12 18 20 36 37 47 52 58 63 64 88 99
sort by rightmost digit
sort by leftmost digit
#include<stdio.h>
#include<conio.h>
 
radix_sort(int array[], int n);
void main()
{
 int array[100],n,i; 
 clrscr();
 printf("Enter the number of elements to 
be sorted: ");
 scanf("%d",&n);
 printf("nEnter the elements to be 
sorted: n");
 for(i = 0 ; i < n ; i++ )
 {
  printf("tArray[%d] = ",i);
  scanf("%d",&array[i]);
 }
printf("nArray Before Radix 
Sort:");  //Array Before Radix Sort
 for(i = 0; i < n; i++)
 {
  printf("%8d", array[i]);
 }
printf("n");
  
 radix_sort(array,n);
 
 printf("nArray After Radix Sort: 
");  //Array After Radix Sort
 for(i = 0; i < n; i++)
 {
  printf("%8d", array[i]);
 }
 printf("n");
 getch();
}
radix_sort(int arr[], int n)
{
int bucket[10][5],buck[10],b[10];
int i,j,k,l,num,div,large,passes;
div=1;
num=0;
large=arr[0];
for(i=0 ; i<n ; i++)
{
if(arr[i] > large)
{
large = arr[i];
}
while(large > 0)
{
num++;
large = large/10;
}
for(passes=0 ; passes<num ; passes++){
for(k=0 ; k<10 ; k++){
buck[k] = 0;
}
for(i=0 ; i<n ;i++)
{
l = ((arr[i]/div)%10);
bucket[l][buck[l]++] = arr[i];
}
i=0;
for(k=0 ; k<10 ; k++)
{
for(j=0 ; j<buck[k] ; j++)
{
arr[i++] = bucket[k][j];
}
}
div*=10;
}}}}
 If there is a fixed number p of bucket sort stages (six
stages in the case where the maximum value is
999999), then radix sort is O( n )
There are p bucket sort stages, each taking
O(n)time
 Strictly speaking, time complexity is
O( pn ), where p is the number of digits (note that p
= log10m, where m is the maximum value in the list)
Merge Sort
The merge sort algorithm comes in two parts: a sort function and a
merge function. The functions in pseudocode look like this:
function mergesort(m)
var list left, right, result
if length(m) ≤ 1
return m
else
var middle = length(m) / 2
for each x in m up to middle - 1
add x to left
for each x in m at and after middle
add x to right
left = mergesort(left)
right = mergesort(right)
if last(left) ≤ first(right)
append right to left
return left
result = merge(left, right)
return result
function merge(left,right)
var list result
while length(left) > 0 and length(right) > 0
if first(left) ≤ first(right)
append first(left) to result
left = rest(left)
else
append first(right) to result
right = rest(right)
if length(left) > 0
append rest(left) to result
if length(right) > 0
append rest(right) to result
return result
Shell Sort
Code
void ShellSort(int *array, int number_of_elements)
{ int i, j, increment, temp;
for(increment=number_of_elements/2; increment>0; increment/=2)
{ for(i=increment; i<number_of_elements; i++)
{ temp=array[i];
for(j=i; j>=increment; j-=increment)
{ if( temp<array[j-increment])
{ array[j]=array[j-increment];
}
else
{ break;
}
}
array[j]=temp;
}
}
Heap Sort
• Heapsort is an in-place sorting algorithm with worst case and average
complexity of O(nlog  n).
Pseudocode :
function heapSort(a, count) is
input: an unordered array a of length count
(first place a in max-heap order)
heapify(a, count)
end := count - 1
while end > 0 do
{(swap the root(maximum value) of the heap with the last element of the
heap)
swap(a[end], a[0])
(decrement the size of the heap so that the previous max value will stay in its
proper place)
end := end - 1
(put the heap back in max-heap order)
shiftDown(a, 0, end)}
function heapify(a,count) is
(start is assigned the index in a of the last parent node)
start := (count - 2) / 2
while start ≥ 0 do
(shift down the node at index start to the proper place such that all nodes below the start index
are in heap order)
shiftDown(a, start, count-1)
start := start - 1
(after shifting down the root all nodes/elements are in heap order)
function shift Down(a, start, end) is (end represents the limit of how far down the heap to shift)
root := start
while root * 2 + 1 ≤ end do (While the root has at least one child)
child := root * 2 + 1 (root*2+1 points to the left child)
(If the child has a sibling and the child's value is less than its sibling's...)
if child + 1 ≤ end and a[child] < a[child + 1] then
child := child + 1 (... then point to the right child instead)
if a[root] < a[child] then (out of max-heap order)
swap(a[root], a[child])
root := child (repeat to continue shifting down the child now)
else
return
The underlying question- How fast
can we sort?
How fast can we sort?(contd.)
It all boils down to these practical choices:It all boils down to these practical choices:
1.1. When N is largeWhen N is large, use Quick Sort., use Quick Sort.
2.2. For small N(<20)For small N(<20), NLogN sorts are, NLogN sorts are
slower due to extra overhead in best caseslower due to extra overhead in best case
(larger constants in big-oh function)(larger constants in big-oh function)
3. For N<203. For N<20, use Insertion sort, use Insertion sort.
Practical Applications of Sorting in
our Modern Life
• Sorting represents fractals (Fractals are infinitely
complex patterns that are self-similar across
different scales. They are created by repeating a
simple process over and over in an ongoing
feedback loop. Driven by
recursion, fractals are images of dynamic
systems – the pictures of Chaos) which is a
basic part of symmetry & coordination & less
randomization.
Sorting is everywhere
knowingly and unknowingly!
Natural Fractal
All of them use many sorting techniques
And almost all other companies of the world,there aren’t really any limits or
boundaries! Sorting techniques are an essential part of our day to day life it has
made our life a lot more easier.
END OF PRESENTATION

More Related Content

What's hot

Data Structures (CS8391)
Data Structures (CS8391)Data Structures (CS8391)
Data Structures (CS8391)
Elavarasi K
 
Queue in Data Structure
Queue in Data Structure Queue in Data Structure
Queue in Data Structure
Janki Shah
 
PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...
PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...
PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...
Umesh Kumar
 
DATA STRUCTURES
DATA STRUCTURESDATA STRUCTURES
DATA STRUCTURES
bca2010
 
Introduction to data structure ppt
Introduction to data structure pptIntroduction to data structure ppt
Introduction to data structure ppt
NalinNishant3
 
Sorting Algorithms
Sorting AlgorithmsSorting Algorithms
Sorting Algorithmsmultimedia9
 
Insertion Sorting
Insertion SortingInsertion Sorting
Insertion Sorting
FarihaHabib123
 
Presentation on Breadth First Search (BFS)
Presentation on Breadth First Search (BFS)Presentation on Breadth First Search (BFS)
Presentation on Breadth First Search (BFS)
Shuvongkor Barman
 
Binary search tree in data structures
Binary search tree in  data structuresBinary search tree in  data structures
Binary search tree in data structures
chauhankapil
 
Data Structure and Algorithms Linked List
Data Structure and Algorithms Linked ListData Structure and Algorithms Linked List
Data Structure and Algorithms Linked List
ManishPrajapati78
 
Binary Search - Design & Analysis of Algorithms
Binary Search - Design & Analysis of AlgorithmsBinary Search - Design & Analysis of Algorithms
Binary Search - Design & Analysis of Algorithms
Drishti Bhalla
 
Doubly Linked List
Doubly Linked ListDoubly Linked List
Doubly Linked List
Ninad Mankar
 
linear search and binary search
linear search and binary searchlinear search and binary search
linear search and binary search
Zia Ush Shamszaman
 
SEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMSSEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMS
Gokul Hari
 
Searching
SearchingSearching
Searching
Ashim Lamichhane
 
Priority Queue in Data Structure
Priority Queue in Data StructurePriority Queue in Data Structure
Priority Queue in Data Structure
Meghaj Mallick
 
Selection sort
Selection sortSelection sort
Selection sort
stella D
 
Selection sort and insertion sort
Selection sort and insertion sortSelection sort and insertion sort
Selection sort and insertion sort
May Ann Mendoza
 
Python tuple
Python   tuplePython   tuple
Python tuple
Mohammed Sikander
 

What's hot (20)

Data Structures (CS8391)
Data Structures (CS8391)Data Structures (CS8391)
Data Structures (CS8391)
 
Queue in Data Structure
Queue in Data Structure Queue in Data Structure
Queue in Data Structure
 
PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...
PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...
PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...
 
DATA STRUCTURES
DATA STRUCTURESDATA STRUCTURES
DATA STRUCTURES
 
Introduction to data structure ppt
Introduction to data structure pptIntroduction to data structure ppt
Introduction to data structure ppt
 
Sorting Algorithms
Sorting AlgorithmsSorting Algorithms
Sorting Algorithms
 
Insertion Sorting
Insertion SortingInsertion Sorting
Insertion Sorting
 
Presentation on Breadth First Search (BFS)
Presentation on Breadth First Search (BFS)Presentation on Breadth First Search (BFS)
Presentation on Breadth First Search (BFS)
 
Binary search tree in data structures
Binary search tree in  data structuresBinary search tree in  data structures
Binary search tree in data structures
 
Data Structure and Algorithms Linked List
Data Structure and Algorithms Linked ListData Structure and Algorithms Linked List
Data Structure and Algorithms Linked List
 
Heap sort
Heap sortHeap sort
Heap sort
 
Binary Search - Design & Analysis of Algorithms
Binary Search - Design & Analysis of AlgorithmsBinary Search - Design & Analysis of Algorithms
Binary Search - Design & Analysis of Algorithms
 
Doubly Linked List
Doubly Linked ListDoubly Linked List
Doubly Linked List
 
linear search and binary search
linear search and binary searchlinear search and binary search
linear search and binary search
 
SEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMSSEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMS
 
Searching
SearchingSearching
Searching
 
Priority Queue in Data Structure
Priority Queue in Data StructurePriority Queue in Data Structure
Priority Queue in Data Structure
 
Selection sort
Selection sortSelection sort
Selection sort
 
Selection sort and insertion sort
Selection sort and insertion sortSelection sort and insertion sort
Selection sort and insertion sort
 
Python tuple
Python   tuplePython   tuple
Python tuple
 

Viewers also liked

Sorting algorithms
Sorting algorithmsSorting algorithms
Sorting algorithms
Vicente García Díaz
 
Lecture 11.2 : sorting
Lecture 11.2 :  sortingLecture 11.2 :  sorting
Lecture 11.2 : sorting
Vivek Bhargav
 
Sorting Algorithm
Sorting AlgorithmSorting Algorithm
Sorting Algorithm
Al Amin
 
Binary Search Tree and AVL
Binary Search Tree and AVLBinary Search Tree and AVL
Binary Search Tree and AVL
Katang Isip
 
(Data Structure) Chapter11 searching & sorting
(Data Structure) Chapter11 searching & sorting(Data Structure) Chapter11 searching & sorting
(Data Structure) Chapter11 searching & sortingFadhil Ismail
 
Lecture 12 data structures and algorithms
Lecture 12 data structures and algorithmsLecture 12 data structures and algorithms
Lecture 12 data structures and algorithmsAakash deep Singhal
 
Nikit
NikitNikit
Binary search
Binary search Binary search
Binary search Raghu nath
 
Lecture 13 data structures and algorithms
Lecture 13 data structures and algorithmsLecture 13 data structures and algorithms
Lecture 13 data structures and algorithmsAakash deep Singhal
 
Sorting algorithm
Sorting algorithmSorting algorithm
Sorting algorithm
Balaji Nangare
 
Lecture 14 data structures and algorithms
Lecture 14 data structures and algorithmsLecture 14 data structures and algorithms
Lecture 14 data structures and algorithmsAakash deep Singhal
 
Binary search tree(bst)
Binary search tree(bst)Binary search tree(bst)
Binary search tree(bst)
Hossain Md Shakhawat
 
Linear Search & Binary Search
Linear Search & Binary SearchLinear Search & Binary Search
Linear Search & Binary Search
Reem Alattas
 
Linear search algorithm
Linear search algorithmLinear search algorithm
Linear search algorithm
NeoClassical
 
Quick Sort
Quick SortQuick Sort
Quick Sort
Shweta Sahu
 
Linear Search Data Structure
Linear Search Data StructureLinear Search Data Structure
Linear Search Data Structure
Talha Shaikh
 
Insertion Sort
Insertion SortInsertion Sort
Insertion Sort
Brett Duncan
 
Binary Search Tree in Data Structure
Binary Search Tree in Data StructureBinary Search Tree in Data Structure
Binary Search Tree in Data Structure
Dharita Chokshi
 

Viewers also liked (20)

Sorting algorithms
Sorting algorithmsSorting algorithms
Sorting algorithms
 
Lecture 11.2 : sorting
Lecture 11.2 :  sortingLecture 11.2 :  sorting
Lecture 11.2 : sorting
 
Sorting
SortingSorting
Sorting
 
Sorting Algorithm
Sorting AlgorithmSorting Algorithm
Sorting Algorithm
 
Binary Search Tree and AVL
Binary Search Tree and AVLBinary Search Tree and AVL
Binary Search Tree and AVL
 
(Data Structure) Chapter11 searching & sorting
(Data Structure) Chapter11 searching & sorting(Data Structure) Chapter11 searching & sorting
(Data Structure) Chapter11 searching & sorting
 
Lecture 12 data structures and algorithms
Lecture 12 data structures and algorithmsLecture 12 data structures and algorithms
Lecture 12 data structures and algorithms
 
Nikit
NikitNikit
Nikit
 
Binary search
Binary search Binary search
Binary search
 
Lecture 13 data structures and algorithms
Lecture 13 data structures and algorithmsLecture 13 data structures and algorithms
Lecture 13 data structures and algorithms
 
Sorting algorithm
Sorting algorithmSorting algorithm
Sorting algorithm
 
Lecture 14 data structures and algorithms
Lecture 14 data structures and algorithmsLecture 14 data structures and algorithms
Lecture 14 data structures and algorithms
 
Binary search tree(bst)
Binary search tree(bst)Binary search tree(bst)
Binary search tree(bst)
 
Linear Search & Binary Search
Linear Search & Binary SearchLinear Search & Binary Search
Linear Search & Binary Search
 
Linear search algorithm
Linear search algorithmLinear search algorithm
Linear search algorithm
 
Quick Sort
Quick SortQuick Sort
Quick Sort
 
Linear Search Data Structure
Linear Search Data StructureLinear Search Data Structure
Linear Search Data Structure
 
Hashing
HashingHashing
Hashing
 
Insertion Sort
Insertion SortInsertion Sort
Insertion Sort
 
Binary Search Tree in Data Structure
Binary Search Tree in Data StructureBinary Search Tree in Data Structure
Binary Search Tree in Data Structure
 

Similar to Sorting Seminar Presentation by Ashin Guha Majumder

Analysis of algorithms
Analysis of algorithms Analysis of algorithms
Analysis of algorithms
MUSAIDRIS15
 
data structures and algorithms Unit 3
data structures and algorithms Unit 3data structures and algorithms Unit 3
data structures and algorithms Unit 3
infanciaj
 
Chapter 4 ds
Chapter 4 dsChapter 4 ds
Chapter 4 ds
Hanif Durad
 
Sorting
SortingSorting
Sorting
BHARATH KUMAR
 
Data Structures 6
Data Structures 6Data Structures 6
Data Structures 6
Dr.Umadevi V
 
Algorithms with-java-advanced-1.0
Algorithms with-java-advanced-1.0Algorithms with-java-advanced-1.0
Algorithms with-java-advanced-1.0
BG Java EE Course
 
Chapter 11 - Sorting and Searching
Chapter 11 - Sorting and SearchingChapter 11 - Sorting and Searching
Chapter 11 - Sorting and Searching
Eduardo Bergavera
 
Insersion & Bubble Sort in Algoritm
Insersion & Bubble Sort in AlgoritmInsersion & Bubble Sort in Algoritm
Insersion & Bubble Sort in Algoritm
Ehsan Ehrari
 
Selection sort
Selection sortSelection sort
Selection sortasra khan
 
Dsa – data structure and algorithms sorting
Dsa – data structure and algorithms  sortingDsa – data structure and algorithms  sorting
Dsa – data structure and algorithms sorting
sajinis3
 
Counting Sort Lowerbound
Counting Sort LowerboundCounting Sort Lowerbound
Counting Sort Lowerbounddespicable me
 
lecture 9
lecture 9lecture 9
lecture 9sajinsc
 
L1803016468
L1803016468L1803016468
L1803016468
IOSR Journals
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
Julie Iskander
 
Data structures arrays
Data structures   arraysData structures   arrays
Data structures arrays
maamir farooq
 
Sorting
SortingSorting
Algorithm Complexity and Main Concepts
Algorithm Complexity and Main ConceptsAlgorithm Complexity and Main Concepts
Algorithm Complexity and Main ConceptsAdelina Ahadova
 
my docoment
my docomentmy docoment
my docoment
NeeshanYonzan
 
Searching and Sorting Algorithms in Data Structures
Searching and Sorting Algorithms  in Data StructuresSearching and Sorting Algorithms  in Data Structures
Searching and Sorting Algorithms in Data Structures
poongothai11
 

Similar to Sorting Seminar Presentation by Ashin Guha Majumder (20)

Analysis of algorithms
Analysis of algorithms Analysis of algorithms
Analysis of algorithms
 
data structures and algorithms Unit 3
data structures and algorithms Unit 3data structures and algorithms Unit 3
data structures and algorithms Unit 3
 
Chapter 4 ds
Chapter 4 dsChapter 4 ds
Chapter 4 ds
 
Sorting
SortingSorting
Sorting
 
Data Structures 6
Data Structures 6Data Structures 6
Data Structures 6
 
Algorithms with-java-advanced-1.0
Algorithms with-java-advanced-1.0Algorithms with-java-advanced-1.0
Algorithms with-java-advanced-1.0
 
Chapter 11 - Sorting and Searching
Chapter 11 - Sorting and SearchingChapter 11 - Sorting and Searching
Chapter 11 - Sorting and Searching
 
Insersion & Bubble Sort in Algoritm
Insersion & Bubble Sort in AlgoritmInsersion & Bubble Sort in Algoritm
Insersion & Bubble Sort in Algoritm
 
Selection sort
Selection sortSelection sort
Selection sort
 
Dsa – data structure and algorithms sorting
Dsa – data structure and algorithms  sortingDsa – data structure and algorithms  sorting
Dsa – data structure and algorithms sorting
 
Counting Sort Lowerbound
Counting Sort LowerboundCounting Sort Lowerbound
Counting Sort Lowerbound
 
lecture 9
lecture 9lecture 9
lecture 9
 
L1803016468
L1803016468L1803016468
L1803016468
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
 
Data structures arrays
Data structures   arraysData structures   arrays
Data structures arrays
 
Sorting
SortingSorting
Sorting
 
Algorithm Complexity and Main Concepts
Algorithm Complexity and Main ConceptsAlgorithm Complexity and Main Concepts
Algorithm Complexity and Main Concepts
 
my docoment
my docomentmy docoment
my docoment
 
Q
QQ
Q
 
Searching and Sorting Algorithms in Data Structures
Searching and Sorting Algorithms  in Data StructuresSearching and Sorting Algorithms  in Data Structures
Searching and Sorting Algorithms in Data Structures
 

Recently uploaded

Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 

Recently uploaded (20)

Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 

Sorting Seminar Presentation by Ashin Guha Majumder

  • 1. SORTINGSORTING Presented By - Ashin Guha Majumder (Roll 551)
  • 2. Sorting means arranging elements of an array so that they are placed in some relevant order which may either be ascending or descending. This order can be numeric, lexicographic or any other user defined type.
  • 3. An internal sort is any data sorting process that takes place entirely within the main memory of a computer. This is possible whenever the data to be sorted is small enough to all be held in the main memory. External sorting is required when the data being sorted do not fit into the main memory of a computing device (usually RAM) and instead they must reside in the slower external memory (usually a hard drive).
  • 4. What is Sorting ? • How do we find the people who most like us on … Amazon, Netflix, Facebook..……Need a metric for analyzing closeness/nearness - Need to find people "close", sorting helps • How does Google find matching web pages? • How does SoundCloud find your song? • How does instagram find your image? • Sorting to the rescue !
  • 5. Sorting in General • How do you search in a "real" dictionary? • How would a DICTIONARY be which is not arranged in alphabetical order ? • Oxford English Dictionary contains full entries for 171,476 words in current use • No sequence – you might find the required word in the first page(Best Case) / an intermediate page(Average Case) / the last page(Worst Case) • Time required would be huge. So definitely an arranged order would help a lot ! • Hence we need sorting especially for asymptotic amounts of data! Workers sorting parcels in a postal facility Workers sorting parcels in a postal facility A railroad classification yard, used for sorting freight cars
  • 6.
  • 7. Theory of the Asymptotic Notation
  • 8.
  • 9.
  • 10. Radix sort is a non-comparative integer sorting algorithm that sorts data with integer keys by grouping keys by the individual digits which share the same sigRadix sort is a non-comparative integer sorting algorithm that sorts data with integer keys by grouping keys by the individual digits which share the same significant position and value. A positional notation is required, but because integers can represent strings of characters (e.g., names or dates) and specially formatted floating point numbers, radix sort is not limited to integers.
  • 11. 12 58 37 64 52 36 99 63 18 9 20 88 47 20 12 52 63 64 36 37 47 58 18 88 9 99 20 12 52 63 64 36 37 47 58 18 88 9 99
  • 12. 9 12 18 20 36 37 47 52 58 63 64 88 99 9 12 18 20 36 37 47 52 58 63 64 99 20 12 52 63 64 36 37 47 58 18 88 9 99 88
  • 13. 12 58 37 64 52 36 99 63 18 9 20 88 47 20 12 52 63 64 36 37 47 58 18 88 9 99 9 12 18 20 36 37 47 52 58 63 64 88 99 sort by rightmost digit sort by leftmost digit
  • 15. radix_sort(int arr[], int n) { int bucket[10][5],buck[10],b[10]; int i,j,k,l,num,div,large,passes; div=1; num=0; large=arr[0]; for(i=0 ; i<n ; i++) { if(arr[i] > large) { large = arr[i]; } while(large > 0) { num++; large = large/10; } for(passes=0 ; passes<num ; passes++){ for(k=0 ; k<10 ; k++){ buck[k] = 0; } for(i=0 ; i<n ;i++) { l = ((arr[i]/div)%10); bucket[l][buck[l]++] = arr[i]; } i=0; for(k=0 ; k<10 ; k++) { for(j=0 ; j<buck[k] ; j++) { arr[i++] = bucket[k][j]; } } div*=10; }}}}
  • 16.  If there is a fixed number p of bucket sort stages (six stages in the case where the maximum value is 999999), then radix sort is O( n ) There are p bucket sort stages, each taking O(n)time  Strictly speaking, time complexity is O( pn ), where p is the number of digits (note that p = log10m, where m is the maximum value in the list)
  • 17. Merge Sort The merge sort algorithm comes in two parts: a sort function and a merge function. The functions in pseudocode look like this: function mergesort(m) var list left, right, result if length(m) ≤ 1 return m else var middle = length(m) / 2 for each x in m up to middle - 1 add x to left for each x in m at and after middle add x to right left = mergesort(left) right = mergesort(right) if last(left) ≤ first(right) append right to left return left result = merge(left, right) return result
  • 18. function merge(left,right) var list result while length(left) > 0 and length(right) > 0 if first(left) ≤ first(right) append first(left) to result left = rest(left) else append first(right) to result right = rest(right) if length(left) > 0 append rest(left) to result if length(right) > 0 append rest(right) to result return result
  • 20. Code void ShellSort(int *array, int number_of_elements) { int i, j, increment, temp; for(increment=number_of_elements/2; increment>0; increment/=2) { for(i=increment; i<number_of_elements; i++) { temp=array[i]; for(j=i; j>=increment; j-=increment) { if( temp<array[j-increment]) { array[j]=array[j-increment]; } else { break; } } array[j]=temp; } }
  • 21.
  • 22. Heap Sort • Heapsort is an in-place sorting algorithm with worst case and average complexity of O(nlog  n). Pseudocode : function heapSort(a, count) is input: an unordered array a of length count (first place a in max-heap order) heapify(a, count) end := count - 1 while end > 0 do {(swap the root(maximum value) of the heap with the last element of the heap) swap(a[end], a[0]) (decrement the size of the heap so that the previous max value will stay in its proper place) end := end - 1 (put the heap back in max-heap order) shiftDown(a, 0, end)}
  • 23. function heapify(a,count) is (start is assigned the index in a of the last parent node) start := (count - 2) / 2 while start ≥ 0 do (shift down the node at index start to the proper place such that all nodes below the start index are in heap order) shiftDown(a, start, count-1) start := start - 1 (after shifting down the root all nodes/elements are in heap order) function shift Down(a, start, end) is (end represents the limit of how far down the heap to shift) root := start while root * 2 + 1 ≤ end do (While the root has at least one child) child := root * 2 + 1 (root*2+1 points to the left child) (If the child has a sibling and the child's value is less than its sibling's...) if child + 1 ≤ end and a[child] < a[child + 1] then child := child + 1 (... then point to the right child instead) if a[root] < a[child] then (out of max-heap order) swap(a[root], a[child]) root := child (repeat to continue shifting down the child now) else return
  • 24. The underlying question- How fast can we sort?
  • 25. How fast can we sort?(contd.) It all boils down to these practical choices:It all boils down to these practical choices: 1.1. When N is largeWhen N is large, use Quick Sort., use Quick Sort. 2.2. For small N(<20)For small N(<20), NLogN sorts are, NLogN sorts are slower due to extra overhead in best caseslower due to extra overhead in best case (larger constants in big-oh function)(larger constants in big-oh function) 3. For N<203. For N<20, use Insertion sort, use Insertion sort.
  • 26. Practical Applications of Sorting in our Modern Life • Sorting represents fractals (Fractals are infinitely complex patterns that are self-similar across different scales. They are created by repeating a simple process over and over in an ongoing feedback loop. Driven by recursion, fractals are images of dynamic systems – the pictures of Chaos) which is a basic part of symmetry & coordination & less randomization. Sorting is everywhere knowingly and unknowingly! Natural Fractal
  • 27. All of them use many sorting techniques And almost all other companies of the world,there aren’t really any limits or boundaries! Sorting techniques are an essential part of our day to day life it has made our life a lot more easier.