SlideShare a Scribd company logo
Course Title: Data Structure Lab
Course Code: ICT-1206
Presentation By:
Misu Das Partha
IT20007
Shouvik Datta
IT20023
Dept. of ICT, MBSTU
Presentation To:
Bikash Kumar Paul
Lecturer,
Dept. of ICT, MBSTU
Date: 1/10/2022
TOPIC NAME : TIM SORT
1
 CONTENTS
 TOPIC
 INTRODUCTION
 PRESENTATION
 CODE
2
 INTRODUCTION
TIM SORT IS A DATA SORTING ALGORITHM.
THIS SORTING STRATEGY IS TO IDENTIFY DATA MEMBERS AND
SORT THEM FURTHER USING BOTH MERGE AND INSERT METHODS.
TIM SORT IS ONE OF THE BEST SORTING ALGORITHMS IN TERMS
OF COMPLEXITY AND STABILITY.
3
TIM SORT WORKING WITH EXAMPLES
14 15 45
4 30
29 33 40
27 28
4
TIM SORT WORKING WITH EXAMPLES
14 15
45
4
30
29 33 40
27 28
Run = 5
Part-1
Part-2
5
FIRSTLY WE ARE SORTING PART-1 ELEMENTS
6
TIM SORT WORKING WITH EXAMPLES
14 15 4
27 28
27 15 4
14 28
1st iteration
7
TIM SORT WORKING WITH EXAMPLES
14 15 4
27 28
14 15 4
27 28
2nd iteration
8
TIM SORT WORKING WITH EXAMPLES
27 15 4
14 28
14 15 4
27 28
3rd iteration
9
TIM SORT WORKING WITH EXAMPLES
27 15 4
14 28
14 28 4
15 27
4th iteration
10
TIM SORT WORKING WITH EXAMPLES
15 28 4
14 27
4 27 28
14 15
5th iteration
11
PART-1 ELEMENTS SORTED
12
NOW WE ARE SORTING PART-2 ELEMENTS
13
TIM SORT WORKING WITH EXAMPLES
29 33 40
45 30
29 33 40
45 30
1st iteration
14
TIM SORT WORKING WITH EXAMPLES
29 33 40
45 30
45 33 40
29 30
2nd iteration
15
TIM SORT WORKING WITH EXAMPLES
45 33 40
29 30
30 33 40
29 45
3rd iteration
16
TIM SORT WORKING WITH EXAMPLES
30 33 40
29 45
30 45 40
29 33
4th iteration
17
TIM SORT WORKING WITH EXAMPLES
30 45 40
29 33
30 40 45
29 33
5th iteration
18
PART-2 ELEMENTS SORTED
19
NOW WE HAVE TO MERGE PART-1 ELEMENTS
& PART-2 ELEMENTS
20
4 27 28
14 15 30 40 45
29 33
Merged Array
4
21
27 28
14 15 30 40 45
29 33
Merged Array
4 14
22
27 28
15 30 40 45
29 33
Merged Array
4 14 15
23
27 28 30 40 45
29 33
Merged Array
4 14 15 27
24
28 30 40 45
29 33
Merged Array
4 14 15 27 28
25
30 40 45
29 33
Merged Array
4 14 15 27 28
26
30 33 40
29 45
Merged Array
4 14 15 27 28 30 33 40
29 45
27
28
 Code
void timSort(int arr[ ], int n){
for (int i = 0; i < n; i+=RUN)
insertionSort(arr, i, min((i+31), (n-1)));
for (int size = RUN; size < n; size = 2*size) {
for (int left = 0; left < n; left += 2*size) {
int mid = left + size - 1;
int right = min((left + 2*size - 1), (n-1));
merge(arr, left, mid, right); }
}
}
int main( ){
int arr[ ] = {27, 14, 28, 15, 4, 45, 29, 30, 33, 40};
int n = sizeof(arr)/sizeof(arr[0]);
printf("Given Array isn");
printArray(arr, n);
timSort(arr, n);
printf("After Sorting Array isn");
printArray(arr, n);
return 0;}
 COMPLEXITY OF TIM SORT
Case Time complexity
Best Case O(n)
Average Case O(nlogn)
Worst Case O(nlogn)
Space Complexity O(n)
29
THANK YOU FOR WATCHING THIS
PRESENTATION

More Related Content

What's hot

Binary code decimal Adder
Binary code decimal AdderBinary code decimal Adder
Binary code decimal AdderHaya Butt
 
Security in an embedded system
Security in an embedded system Security in an embedded system
Security in an embedded system
UrmilasSrinivasan
 
Arduino traffic lights
Arduino traffic lightsArduino traffic lights
Arduino traffic lightsqichengpan
 
Electronics: Logic Gates
Electronics: Logic GatesElectronics: Logic Gates
Electronics: Logic Gates
Marc Owen Rentap anak Dineal Gumis
 
maze game
maze gamemaze game
maze game
Anirban Sarkar
 
Password management
Password managementPassword management
Password management
Sai Kumar
 
Operators and Control Statements in Python
Operators and Control Statements in PythonOperators and Control Statements in Python
Operators and Control Statements in Python
RajeswariA8
 
Ficha técnica Toyota All New Corolla 2014
Ficha técnica Toyota All New Corolla 2014Ficha técnica Toyota All New Corolla 2014
Ficha técnica Toyota All New Corolla 2014rfarias_10
 
Security in Embedded systems
Security in Embedded systems Security in Embedded systems
Security in Embedded systems
Naveen Jakhar, I.T.S
 
Counting Sort
Counting SortCounting Sort
Counting Sort
Faiza Saleem
 
Lecture 6
Lecture 6Lecture 6
Lecture 6
Chamila Fernando
 
Traffic signal
Traffic signalTraffic signal
Traffic signal
Riaz Gul Sheikh
 
Bcd adder
Bcd adderBcd adder
Bcd adder
Asif Iqbal
 
Programming with arduino
Programming with arduinoProgramming with arduino
Programming with arduino
Makers of India
 
Logic gates And Boolen algebra
Logic gates And  Boolen algebraLogic gates And  Boolen algebra
Logic gates And Boolen algebra
Veera Venky
 
Power the world with mbed LPC1768
Power the world with mbed LPC1768Power the world with mbed LPC1768
Power the world with mbed LPC1768
yoonghm
 
Bcd to 7 segment display
Bcd to 7 segment displayBcd to 7 segment display
Bcd to 7 segment display
Maulik Sanchela
 
Material List for High School Musical
Material List for High School MusicalMaterial List for High School Musical
Material List for High School MusicalJoe_Roberts97
 
Information security
Information security Information security
Information security
razendar79
 
FYBSC IT Digital Electronics Unit III Chapter II Arithmetic Circuits
FYBSC IT Digital Electronics Unit III Chapter II Arithmetic CircuitsFYBSC IT Digital Electronics Unit III Chapter II Arithmetic Circuits
FYBSC IT Digital Electronics Unit III Chapter II Arithmetic Circuits
Arti Parab Academics
 

What's hot (20)

Binary code decimal Adder
Binary code decimal AdderBinary code decimal Adder
Binary code decimal Adder
 
Security in an embedded system
Security in an embedded system Security in an embedded system
Security in an embedded system
 
Arduino traffic lights
Arduino traffic lightsArduino traffic lights
Arduino traffic lights
 
Electronics: Logic Gates
Electronics: Logic GatesElectronics: Logic Gates
Electronics: Logic Gates
 
maze game
maze gamemaze game
maze game
 
Password management
Password managementPassword management
Password management
 
Operators and Control Statements in Python
Operators and Control Statements in PythonOperators and Control Statements in Python
Operators and Control Statements in Python
 
Ficha técnica Toyota All New Corolla 2014
Ficha técnica Toyota All New Corolla 2014Ficha técnica Toyota All New Corolla 2014
Ficha técnica Toyota All New Corolla 2014
 
Security in Embedded systems
Security in Embedded systems Security in Embedded systems
Security in Embedded systems
 
Counting Sort
Counting SortCounting Sort
Counting Sort
 
Lecture 6
Lecture 6Lecture 6
Lecture 6
 
Traffic signal
Traffic signalTraffic signal
Traffic signal
 
Bcd adder
Bcd adderBcd adder
Bcd adder
 
Programming with arduino
Programming with arduinoProgramming with arduino
Programming with arduino
 
Logic gates And Boolen algebra
Logic gates And  Boolen algebraLogic gates And  Boolen algebra
Logic gates And Boolen algebra
 
Power the world with mbed LPC1768
Power the world with mbed LPC1768Power the world with mbed LPC1768
Power the world with mbed LPC1768
 
Bcd to 7 segment display
Bcd to 7 segment displayBcd to 7 segment display
Bcd to 7 segment display
 
Material List for High School Musical
Material List for High School MusicalMaterial List for High School Musical
Material List for High School Musical
 
Information security
Information security Information security
Information security
 
FYBSC IT Digital Electronics Unit III Chapter II Arithmetic Circuits
FYBSC IT Digital Electronics Unit III Chapter II Arithmetic CircuitsFYBSC IT Digital Electronics Unit III Chapter II Arithmetic Circuits
FYBSC IT Digital Electronics Unit III Chapter II Arithmetic Circuits
 

Similar to Tim sort presentation.pdf

2022-S1-IT2070-Lecture-06-Algorithms.pptx
2022-S1-IT2070-Lecture-06-Algorithms.pptx2022-S1-IT2070-Lecture-06-Algorithms.pptx
2022-S1-IT2070-Lecture-06-Algorithms.pptx
pradeepwalter
 
REvit training
REvit trainingREvit training
REvit training
srinivasanvenkat10
 
14-sorting.ppt
14-sorting.ppt14-sorting.ppt
14-sorting.ppt
RenalthaPujaBagaskar
 
14-sorting (3).ppt
14-sorting (3).ppt14-sorting (3).ppt
14-sorting (3).ppt
yasser3omr
 
14-sorting.ppt
14-sorting.ppt14-sorting.ppt
14-sorting.ppt
SushantRaj25
 
14-sorting.ppt
14-sorting.ppt14-sorting.ppt
14-sorting.ppt
KamalAlbashiri
 
Applications of pert
Applications of pertApplications of pert
Applications of pert
nitigga92
 
Ds lab manual by s.k.rath
Ds lab manual by s.k.rathDs lab manual by s.k.rath
Ds lab manual by s.k.rathSANTOSH RATH
 
Introduction to computing Processing and performance.pdf
Introduction to computing Processing and performance.pdfIntroduction to computing Processing and performance.pdf
Introduction to computing Processing and performance.pdf
TulasiramKandula1
 
딥러닝 중급 - AlexNet과 VggNet (Basic of DCNN : AlexNet and VggNet)
딥러닝 중급 - AlexNet과 VggNet (Basic of DCNN : AlexNet and VggNet)딥러닝 중급 - AlexNet과 VggNet (Basic of DCNN : AlexNet and VggNet)
딥러닝 중급 - AlexNet과 VggNet (Basic of DCNN : AlexNet and VggNet)
Hansol Kang
 
Effective Numerical Computation in NumPy and SciPy
Effective Numerical Computation in NumPy and SciPyEffective Numerical Computation in NumPy and SciPy
Effective Numerical Computation in NumPy and SciPy
Kimikazu Kato
 
IRJET- Matrix Multiplication using Strassen’s Method
IRJET-  	  Matrix Multiplication using Strassen’s MethodIRJET-  	  Matrix Multiplication using Strassen’s Method
IRJET- Matrix Multiplication using Strassen’s Method
IRJET Journal
 
Chasing the optimizer
Chasing the optimizerChasing the optimizer
Chasing the optimizer
Mauro Pagano
 
indeterminate-truss-lab-report.pdf
indeterminate-truss-lab-report.pdfindeterminate-truss-lab-report.pdf
indeterminate-truss-lab-report.pdf
AzamUddin15
 
Reducing computational complexity of Mathematical functions using FPGA
Reducing computational complexity of Mathematical functions using FPGAReducing computational complexity of Mathematical functions using FPGA
Reducing computational complexity of Mathematical functions using FPGA
nehagaur339
 

Similar to Tim sort presentation.pdf (20)

2022-S1-IT2070-Lecture-06-Algorithms.pptx
2022-S1-IT2070-Lecture-06-Algorithms.pptx2022-S1-IT2070-Lecture-06-Algorithms.pptx
2022-S1-IT2070-Lecture-06-Algorithms.pptx
 
pert_n_cpm.ppt
pert_n_cpm.pptpert_n_cpm.ppt
pert_n_cpm.ppt
 
pert_n_cpm.ppt
pert_n_cpm.pptpert_n_cpm.ppt
pert_n_cpm.ppt
 
REvit training
REvit trainingREvit training
REvit training
 
14-sorting.ppt
14-sorting.ppt14-sorting.ppt
14-sorting.ppt
 
14-sorting (3).ppt
14-sorting (3).ppt14-sorting (3).ppt
14-sorting (3).ppt
 
14-sorting.ppt
14-sorting.ppt14-sorting.ppt
14-sorting.ppt
 
14-sorting.ppt
14-sorting.ppt14-sorting.ppt
14-sorting.ppt
 
Applications of pert
Applications of pertApplications of pert
Applications of pert
 
Project Management Techniques
Project Management TechniquesProject Management Techniques
Project Management Techniques
 
Ds lab manual by s.k.rath
Ds lab manual by s.k.rathDs lab manual by s.k.rath
Ds lab manual by s.k.rath
 
Introduction to computing Processing and performance.pdf
Introduction to computing Processing and performance.pdfIntroduction to computing Processing and performance.pdf
Introduction to computing Processing and performance.pdf
 
딥러닝 중급 - AlexNet과 VggNet (Basic of DCNN : AlexNet and VggNet)
딥러닝 중급 - AlexNet과 VggNet (Basic of DCNN : AlexNet and VggNet)딥러닝 중급 - AlexNet과 VggNet (Basic of DCNN : AlexNet and VggNet)
딥러닝 중급 - AlexNet과 VggNet (Basic of DCNN : AlexNet and VggNet)
 
Effective Numerical Computation in NumPy and SciPy
Effective Numerical Computation in NumPy and SciPyEffective Numerical Computation in NumPy and SciPy
Effective Numerical Computation in NumPy and SciPy
 
IRJET- Matrix Multiplication using Strassen’s Method
IRJET-  	  Matrix Multiplication using Strassen’s MethodIRJET-  	  Matrix Multiplication using Strassen’s Method
IRJET- Matrix Multiplication using Strassen’s Method
 
Ds 6
Ds 6Ds 6
Ds 6
 
Chasing the optimizer
Chasing the optimizerChasing the optimizer
Chasing the optimizer
 
Insertion Sort Code
Insertion Sort CodeInsertion Sort Code
Insertion Sort Code
 
indeterminate-truss-lab-report.pdf
indeterminate-truss-lab-report.pdfindeterminate-truss-lab-report.pdf
indeterminate-truss-lab-report.pdf
 
Reducing computational complexity of Mathematical functions using FPGA
Reducing computational complexity of Mathematical functions using FPGAReducing computational complexity of Mathematical functions using FPGA
Reducing computational complexity of Mathematical functions using FPGA
 

Recently uploaded

NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
ssuser7dcef0
 
Unbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptxUnbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptx
ChristineTorrepenida1
 
AIR POLLUTION lecture EnE203 updated.pdf
AIR POLLUTION lecture EnE203 updated.pdfAIR POLLUTION lecture EnE203 updated.pdf
AIR POLLUTION lecture EnE203 updated.pdf
RicletoEspinosa1
 
Online aptitude test management system project report.pdf
Online aptitude test management system project report.pdfOnline aptitude test management system project report.pdf
Online aptitude test management system project report.pdf
Kamal Acharya
 
Fundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptxFundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptx
manasideore6
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
nooriasukmaningtyas
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
Madan Karki
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
heavyhaig
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
ydteq
 
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.pptPROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
bhadouriyakaku
 
Self-Control of Emotions by Slidesgo.pptx
Self-Control of Emotions by Slidesgo.pptxSelf-Control of Emotions by Slidesgo.pptx
Self-Control of Emotions by Slidesgo.pptx
iemerc2024
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
WENKENLI1
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
ssuser36d3051
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
SyedAbiiAzazi1
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
Rahul
 

Recently uploaded (20)

NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
 
Unbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptxUnbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptx
 
AIR POLLUTION lecture EnE203 updated.pdf
AIR POLLUTION lecture EnE203 updated.pdfAIR POLLUTION lecture EnE203 updated.pdf
AIR POLLUTION lecture EnE203 updated.pdf
 
Online aptitude test management system project report.pdf
Online aptitude test management system project report.pdfOnline aptitude test management system project report.pdf
Online aptitude test management system project report.pdf
 
Fundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptxFundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptx
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
 
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.pptPROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
 
Self-Control of Emotions by Slidesgo.pptx
Self-Control of Emotions by Slidesgo.pptxSelf-Control of Emotions by Slidesgo.pptx
Self-Control of Emotions by Slidesgo.pptx
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
 

Tim sort presentation.pdf

  • 1. Course Title: Data Structure Lab Course Code: ICT-1206 Presentation By: Misu Das Partha IT20007 Shouvik Datta IT20023 Dept. of ICT, MBSTU Presentation To: Bikash Kumar Paul Lecturer, Dept. of ICT, MBSTU Date: 1/10/2022
  • 2. TOPIC NAME : TIM SORT 1
  • 3.  CONTENTS  TOPIC  INTRODUCTION  PRESENTATION  CODE 2
  • 4.  INTRODUCTION TIM SORT IS A DATA SORTING ALGORITHM. THIS SORTING STRATEGY IS TO IDENTIFY DATA MEMBERS AND SORT THEM FURTHER USING BOTH MERGE AND INSERT METHODS. TIM SORT IS ONE OF THE BEST SORTING ALGORITHMS IN TERMS OF COMPLEXITY AND STABILITY. 3
  • 5. TIM SORT WORKING WITH EXAMPLES 14 15 45 4 30 29 33 40 27 28 4
  • 6. TIM SORT WORKING WITH EXAMPLES 14 15 45 4 30 29 33 40 27 28 Run = 5 Part-1 Part-2 5
  • 7. FIRSTLY WE ARE SORTING PART-1 ELEMENTS 6
  • 8. TIM SORT WORKING WITH EXAMPLES 14 15 4 27 28 27 15 4 14 28 1st iteration 7
  • 9. TIM SORT WORKING WITH EXAMPLES 14 15 4 27 28 14 15 4 27 28 2nd iteration 8
  • 10. TIM SORT WORKING WITH EXAMPLES 27 15 4 14 28 14 15 4 27 28 3rd iteration 9
  • 11. TIM SORT WORKING WITH EXAMPLES 27 15 4 14 28 14 28 4 15 27 4th iteration 10
  • 12. TIM SORT WORKING WITH EXAMPLES 15 28 4 14 27 4 27 28 14 15 5th iteration 11
  • 14. NOW WE ARE SORTING PART-2 ELEMENTS 13
  • 15. TIM SORT WORKING WITH EXAMPLES 29 33 40 45 30 29 33 40 45 30 1st iteration 14
  • 16. TIM SORT WORKING WITH EXAMPLES 29 33 40 45 30 45 33 40 29 30 2nd iteration 15
  • 17. TIM SORT WORKING WITH EXAMPLES 45 33 40 29 30 30 33 40 29 45 3rd iteration 16
  • 18. TIM SORT WORKING WITH EXAMPLES 30 33 40 29 45 30 45 40 29 33 4th iteration 17
  • 19. TIM SORT WORKING WITH EXAMPLES 30 45 40 29 33 30 40 45 29 33 5th iteration 18
  • 21. NOW WE HAVE TO MERGE PART-1 ELEMENTS & PART-2 ELEMENTS 20
  • 22. 4 27 28 14 15 30 40 45 29 33 Merged Array 4 21
  • 23. 27 28 14 15 30 40 45 29 33 Merged Array 4 14 22
  • 24. 27 28 15 30 40 45 29 33 Merged Array 4 14 15 23
  • 25. 27 28 30 40 45 29 33 Merged Array 4 14 15 27 24
  • 26. 28 30 40 45 29 33 Merged Array 4 14 15 27 28 25
  • 27. 30 40 45 29 33 Merged Array 4 14 15 27 28 26 30 33 40 29 45
  • 28. Merged Array 4 14 15 27 28 30 33 40 29 45 27
  • 29. 28  Code void timSort(int arr[ ], int n){ for (int i = 0; i < n; i+=RUN) insertionSort(arr, i, min((i+31), (n-1))); for (int size = RUN; size < n; size = 2*size) { for (int left = 0; left < n; left += 2*size) { int mid = left + size - 1; int right = min((left + 2*size - 1), (n-1)); merge(arr, left, mid, right); } } } int main( ){ int arr[ ] = {27, 14, 28, 15, 4, 45, 29, 30, 33, 40}; int n = sizeof(arr)/sizeof(arr[0]); printf("Given Array isn"); printArray(arr, n); timSort(arr, n); printf("After Sorting Array isn"); printArray(arr, n); return 0;}
  • 30.  COMPLEXITY OF TIM SORT Case Time complexity Best Case O(n) Average Case O(nlogn) Worst Case O(nlogn) Space Complexity O(n) 29
  • 31. THANK YOU FOR WATCHING THIS PRESENTATION