SlideShare a Scribd company logo
1 of 22
IMPLEMENTING MERGE-SORT
OUTLINE
 INTRODUCTION
 Divide & Conquer approach
 Illustration
 LITERATURE REVIEW
 PROBLEM STATEMENT
 CONCLUSION
 REFERENCES
2
INTRODUCTION
3
 Merge Sort:
 "Break the data to sort in half, sort each half separately using
merge sort, and merge the halves back together into a single
sorted list."
 It employs a common algorithmic paradigm based on
recursion, i.e. divide-and-conquer paradigm.
 Divide-and-conquer algorithm works in three steps:
 Divide
 Conquer
 Combine
DIVIDE & CONQUER APPROACH
4
Fig. 1: Divide & Conquer view of one
step[3]
Here's how to view one step, assuming that each divide step
creates two subproblems:
ILLUSTRATION
5
Here is a diagrammatic example for how merge sort works:
Fig. 2: Merge Sort Working[5]
LITERATURE-REVIEW
6
LITERATURE-REVIEW(1/2)
7
 Title: ” Formal Model Merging Applied to Class
Diagram Integration”[1]
Authors: Artur Boronat, Jose A. C., Isidro Ramos, Patrico Letelier
 Objective: The definition of Merge operator is applied on class
diagrams integration to present an automated approach for
generic model merging providing support for conflict
resolution and traceability between software artifacts.
Keywords: Model-Driven Engineering, Model Management, model
merging, conflict resolution.
LITERATURE-REVIEW(1/2 Cont..)
8
 Introduction:
 Models are the main assets in the software
development process.
 Models collect the information that describes the
information system at a high abstraction level, which
permits the development of the application in an
automated way.
 In this process, models constitute software artifacts
that experience refinements from the problem space to
the solution space.
CASE STUDY
9
 Use Case Analysis using Partial Class
Diagrams:
 Case Study - To illustrate how Merge operator can be
used effectively to deal with the required needs like
inconsistencies or conflicts among partial models
which often arises, etc.
 Here, part of a system for managing submissions that
are received in a conference is presented.
 In this example, the focus is on the fragment of the
Use-Case Model (Fig. 3).
USE CASE MODEL
10
Software development methodologies based on UML propose an approach where
the process is Use Case Driven, which means that all artifacts have traceability
links from Use Cases (The artifacts are refined through several transformation
steps).
The Use Case Model must sacrifice precision to facilitate readability and
validation. So, the analysis of use cases is mainly a manual activity.
Fig. 3: Use Case Model[1]
GENERIC SEMANTICS
11
 Merge Operator:
 The Merge operator takes two models as input and
produces a third one.
 If A and B are models in a specific meta-model
algebraic specification, the application of the Merge
operator on them produces a model C, which consists
the union of A and B.
 Taking into account that duplicates are not allowed in a
model, the union is disjoint.
LITERATURE-REVIEW(1/2 Cont..)
12
 Semantics of the Merge operator needs to introduce three
concepts:
 The equivalence relation;
 The conflict resolution strategy;
 The refreshment of a construct.
UML CASE tools permit the arrangement of Use Cases and their
corresponding partial Class Diagram into the same package, i.e. no option
is provided to obtain the global Class Diagram from the partial ones.
The Rational Rose Model Integration tool provides an ad-hoc solution to
merge UML models.
Once the merged model is generated, there is no way to relate the
obtained model to the partial source models in order to keep some degree
of traceability.
LITERATURE-REVIEW(2/2)
13
 Title: “Heuristic and pattern based Merge Sort”[2]
Author: Manouchehr Zadahmaf jafarlou, Parisa Yousefzadeh fard
 Objective: The aim of this study is to present a stable and
adaptable Merge Sort algorithm that uses the design
patterns to reduce computational complexity of swaps and
memory usage.
 Keywords: Merge sort, Design patterns, computational complexity.
LITERATURE-REVIEW(2/2 Cont..)
14
 Introduction:
 Although many consider that sorting algorithm is a solved
problem, useful new sorting algorithms are still being
invented (for example, library sort was first published in
2004).
 Sorting algorithms are prevalent in introductory computer
science classes, where the abundance of algorithms for the
problem provides a gentle introduction to a variety of core
algorithm concepts, such as big O notation, divide and
conquer algorithms, data structures, best, worst and average
case analysis, etc.
15
 Sorting algorithms used in computer science are often
classified as:
 Computational complexity.
 Memory usage.
 Recursion.
 Stability: stable sorting algorithms maintain the relative order of
records with equal values.
 Whether or not they are a comparison sort. A comparison sort
examines the data only by comparing two elements with a
comparison operator.
 General method: insertion, exchange, selection, merging, etc.
 Adaptability: Whether or not the pre sorted-ness of the input
affects the running time.
CLASSIFICATION
LITERATURE-REVIEW(2/2 Cont..)
16
 Heuristic and pattern based Merge Sort implementation:
Fig. 4. Heuristic and pattern based Merge Sort implementation[2]
LITERATURE-REVIEW(2/2 Cont..)
17
 First algorithm:
 First element of status is the index of first element of next partial
array and the second one represent "the number of elements of
partial array“ (+1) for ascending partial array or (-1) for
descending partial array.
 Used when the numbers of arrays are so many that cannot move
to volatile memory.
 Ex.: Given array -4, -3, 0, 1, 3, 8, 9, 14, 5, 6, 8, 14, 2, 1, -3, 1 ..
 if the (-4, -3, 0, 1, 3, 8, 9, 14) be the part of array that sorted
before with stMS, (5, 6, 8, 14) will be the next partial ordered
array and so the status array is (8, +4).
LITERATURE-REVIEW(2/2 Cont..)
18
 Second algorithm:
 “The first index of first entry of partial arrays" (+1) for
ascending arrays and "the first index of first entry of partial
arrays" (-1) for descending arrays.
 Causes a high performance by eliminating of first steps of merge
sort algorithm.
 For example for array -8, -4, 0, 4, 3, 1, 0, -2, 5, 7, 9, 10, 5, 4, 2,
1, 3
 For status: +1, -4, +8, -12, +15; Partial arrays are indexed as 0->3
(ascending), 4->7 (descending), 8->11 (ascending), 12->14
(descending), 15->15 (ascending). Then status send as argument
to stgMS and partial arrays will be the building blocks for stgM
algorithm.
LITERATURE-REVIEW(2/2 Cont..)
19
 Third algorithm:
 “The number of partial arrays " (+1) for ascending arrays
and "the number of partial arrays" (-1) for descending
arrays.
 Here, stgMS is a Huffman coding algorithm used to Optimize the
merging process by choosing two partial arrays, that sum of
elements of them is less than others before each merging.
 Then these two partial arrays send as argument to stgM
algorithm and merged.
PROBLEM STATEMENT
20
 When the Use Case Model has many use cases,
managing traceability between each use case and the
corresponding elements in the resulting class diagram
can be a difficult task.
 Regarding traceability, this strategy is a sensible
solution, but when several team members work in
parallel with different use cases, inconsistencies or
conflicts among partial models often arise, which must
be solved when obtaining the integrated model.
CONCLUSION
21
 Merge sort is an appropriate algorithm with O(nlgn)
Computational complexity, but petitioning of array to one
element partial arrays and then merging them cause
increasing complexity in time order, system software and
hardware work.
 The presented algorithm eliminates these extra work using
patterns.
REFERENCES
22
1. Artur Boronat, Jose A. C., Isidro Ramos, Patrico Letelier,” Formal Model Merging
Applied to Class Diagram Integration”, © 2006-Elsevier.
2. Manouchehr Zadahmaf jafarlou, Parisa Yousefzadeh fard,” Heuristic and pattern
based Merge Sort”, © 2010-Elsevier.
3. https://www.khanacademy.org/computing/computer-science/algorithms/merge-
sort/a/divide-and-conquer-algorithms [09/12/2015, 22:33]
4. http://computationaltales.blogspot.in/2011/10/merge-sort-and-lines-of-
kindergarteners.html [09/12/2015, 22:13]
5. http://coding-geek.com/how-databases-work/ [09/12/2015, 22:28]

More Related Content

Viewers also liked

A Cost-Effective and Scalable Merge Sort Tree on FPGAs
A Cost-Effective and Scalable Merge Sort Tree on FPGAsA Cost-Effective and Scalable Merge Sort Tree on FPGAs
A Cost-Effective and Scalable Merge Sort Tree on FPGAs
Takuma Usui
 
Java presentation on insertion sort
Java presentation on insertion sortJava presentation on insertion sort
Java presentation on insertion sort
_fahad_shaikh
 
Merge sort
Merge sortMerge sort
Merge sort
Kumar
 

Viewers also liked (20)

05 dc1
05 dc105 dc1
05 dc1
 
Algorithms lecture 3
Algorithms lecture 3Algorithms lecture 3
Algorithms lecture 3
 
A Cost-Effective and Scalable Merge Sort Tree on FPGAs
A Cost-Effective and Scalable Merge Sort Tree on FPGAsA Cost-Effective and Scalable Merge Sort Tree on FPGAs
A Cost-Effective and Scalable Merge Sort Tree on FPGAs
 
Merge sort algorithm
Merge sort algorithmMerge sort algorithm
Merge sort algorithm
 
Lecture 3 insertion sort and complexity analysis
Lecture 3   insertion sort and complexity analysisLecture 3   insertion sort and complexity analysis
Lecture 3 insertion sort and complexity analysis
 
Java presentation on insertion sort
Java presentation on insertion sortJava presentation on insertion sort
Java presentation on insertion sort
 
Insertion sort
Insertion sort Insertion sort
Insertion sort
 
Merge sort
Merge sortMerge sort
Merge sort
 
Intro to Sorting + Insertion Sort
Intro to Sorting + Insertion SortIntro to Sorting + Insertion Sort
Intro to Sorting + Insertion Sort
 
Insertion Sort Demo
Insertion Sort DemoInsertion Sort Demo
Insertion Sort Demo
 
Insertion Sort
Insertion SortInsertion Sort
Insertion Sort
 
Intersection Study - Algorithm(Sort)
Intersection Study - Algorithm(Sort)Intersection Study - Algorithm(Sort)
Intersection Study - Algorithm(Sort)
 
Data Structure Insertion sort
Data Structure Insertion sort Data Structure Insertion sort
Data Structure Insertion sort
 
Merge sort
Merge sortMerge sort
Merge sort
 
Merge sort
Merge sortMerge sort
Merge sort
 
Insertion sort
Insertion sortInsertion sort
Insertion sort
 
Merge sort
Merge sortMerge sort
Merge sort
 
MSc_thesis
MSc_thesisMSc_thesis
MSc_thesis
 
Merge sort
Merge sortMerge sort
Merge sort
 
Insertion and merge sort
Insertion and merge sortInsertion and merge sort
Insertion and merge sort
 

Similar to Implementing Merge Sort

Modularizing Arcihtectures Using Dendrograms1
Modularizing Arcihtectures Using Dendrograms1Modularizing Arcihtectures Using Dendrograms1
Modularizing Arcihtectures Using Dendrograms1
victor tang
 
Design pattern (week 2)
Design pattern (week 2)Design pattern (week 2)
Design pattern (week 2)
stanbridge
 

Similar to Implementing Merge Sort (20)

Parallel Machine Learning
Parallel Machine LearningParallel Machine Learning
Parallel Machine Learning
 
Modularizing Arcihtectures Using Dendrograms1
Modularizing Arcihtectures Using Dendrograms1Modularizing Arcihtectures Using Dendrograms1
Modularizing Arcihtectures Using Dendrograms1
 
Design pattern (week 2)
Design pattern (week 2)Design pattern (week 2)
Design pattern (week 2)
 
Data clustering using map reduce
Data clustering using map reduceData clustering using map reduce
Data clustering using map reduce
 
BARRACUDA, AN OPEN SOURCE FRAMEWORK FOR PARALLELIZING DIVIDE AND CONQUER ALGO...
BARRACUDA, AN OPEN SOURCE FRAMEWORK FOR PARALLELIZING DIVIDE AND CONQUER ALGO...BARRACUDA, AN OPEN SOURCE FRAMEWORK FOR PARALLELIZING DIVIDE AND CONQUER ALGO...
BARRACUDA, AN OPEN SOURCE FRAMEWORK FOR PARALLELIZING DIVIDE AND CONQUER ALGO...
 
The International Journal of Engineering and Science (The IJES)
The International Journal of Engineering and Science (The IJES)The International Journal of Engineering and Science (The IJES)
The International Journal of Engineering and Science (The IJES)
 
Generation of Testcases from UML Sequence Diagram and Detecting Deadlocks usi...
Generation of Testcases from UML Sequence Diagram and Detecting Deadlocks usi...Generation of Testcases from UML Sequence Diagram and Detecting Deadlocks usi...
Generation of Testcases from UML Sequence Diagram and Detecting Deadlocks usi...
 
Data Analysis – Technical learnings
Data Analysis – Technical learningsData Analysis – Technical learnings
Data Analysis – Technical learnings
 
Analytic Hierarchy Process And Multilayer Network-Based Method For Assembly L...
Analytic Hierarchy Process And Multilayer Network-Based Method For Assembly L...Analytic Hierarchy Process And Multilayer Network-Based Method For Assembly L...
Analytic Hierarchy Process And Multilayer Network-Based Method For Assembly L...
 
mapReduce for machine learning
mapReduce for machine learning mapReduce for machine learning
mapReduce for machine learning
 
UML2SAN: Toward A New Software Performance Engineering Approach
UML2SAN: Toward A New Software Performance Engineering ApproachUML2SAN: Toward A New Software Performance Engineering Approach
UML2SAN: Toward A New Software Performance Engineering Approach
 
A comparative study of three validities computation methods for multimodel ap...
A comparative study of three validities computation methods for multimodel ap...A comparative study of three validities computation methods for multimodel ap...
A comparative study of three validities computation methods for multimodel ap...
 
Adapted Branch-and-Bound Algorithm Using SVM With Model Selection
Adapted Branch-and-Bound Algorithm Using SVM With Model SelectionAdapted Branch-and-Bound Algorithm Using SVM With Model Selection
Adapted Branch-and-Bound Algorithm Using SVM With Model Selection
 
SCIENTIFIC WORKFLOW CLUSTERING BASED ON MOTIF DISCOVERY
SCIENTIFIC WORKFLOW CLUSTERING BASED ON MOTIF DISCOVERYSCIENTIFIC WORKFLOW CLUSTERING BASED ON MOTIF DISCOVERY
SCIENTIFIC WORKFLOW CLUSTERING BASED ON MOTIF DISCOVERY
 
Intruction to Algorithms.pptx
Intruction to Algorithms.pptxIntruction to Algorithms.pptx
Intruction to Algorithms.pptx
 
Chapitre 08
Chapitre 08Chapitre 08
Chapitre 08
 
SCIENTIFIC WORKFLOW CLUSTERING BASED ON MOTIF DISCOVERY
SCIENTIFIC WORKFLOW CLUSTERING BASED ON MOTIF DISCOVERYSCIENTIFIC WORKFLOW CLUSTERING BASED ON MOTIF DISCOVERY
SCIENTIFIC WORKFLOW CLUSTERING BASED ON MOTIF DISCOVERY
 
Scimakelatex.93126.cocoon.bobbin
Scimakelatex.93126.cocoon.bobbinScimakelatex.93126.cocoon.bobbin
Scimakelatex.93126.cocoon.bobbin
 
Efficient & Lock-Free Modified Skip List in Concurrent Environment
Efficient & Lock-Free Modified Skip List in Concurrent EnvironmentEfficient & Lock-Free Modified Skip List in Concurrent Environment
Efficient & Lock-Free Modified Skip List in Concurrent Environment
 
A Framework For Unifying Problem-Solving Knowledge And Workflow Modelling
A Framework For Unifying Problem-Solving Knowledge And Workflow ModellingA Framework For Unifying Problem-Solving Knowledge And Workflow Modelling
A Framework For Unifying Problem-Solving Knowledge And Workflow Modelling
 

More from smita gupta (6)

Web Testing
Web TestingWeb Testing
Web Testing
 
Mimicking Human Brain Process
Mimicking Human Brain ProcessMimicking Human Brain Process
Mimicking Human Brain Process
 
GSM Security
GSM SecurityGSM Security
GSM Security
 
Experimental Analysis Of On Demand Routing Protocol
Experimental Analysis Of On Demand Routing ProtocolExperimental Analysis Of On Demand Routing Protocol
Experimental Analysis Of On Demand Routing Protocol
 
Enlightening Society On The Alert
Enlightening Society On The AlertEnlightening Society On The Alert
Enlightening Society On The Alert
 
Distributed System Security Aspects
Distributed System Security AspectsDistributed System Security Aspects
Distributed System Security Aspects
 

Recently uploaded

Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
mphochane1998
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
Epec Engineered Technologies
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
Kamal Acharya
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
HenryBriggs2
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
AldoGarca30
 

Recently uploaded (20)

Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
 
Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...
Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...
Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 

Implementing Merge Sort

  • 2. OUTLINE  INTRODUCTION  Divide & Conquer approach  Illustration  LITERATURE REVIEW  PROBLEM STATEMENT  CONCLUSION  REFERENCES 2
  • 3. INTRODUCTION 3  Merge Sort:  "Break the data to sort in half, sort each half separately using merge sort, and merge the halves back together into a single sorted list."  It employs a common algorithmic paradigm based on recursion, i.e. divide-and-conquer paradigm.  Divide-and-conquer algorithm works in three steps:  Divide  Conquer  Combine
  • 4. DIVIDE & CONQUER APPROACH 4 Fig. 1: Divide & Conquer view of one step[3] Here's how to view one step, assuming that each divide step creates two subproblems:
  • 5. ILLUSTRATION 5 Here is a diagrammatic example for how merge sort works: Fig. 2: Merge Sort Working[5]
  • 7. LITERATURE-REVIEW(1/2) 7  Title: ” Formal Model Merging Applied to Class Diagram Integration”[1] Authors: Artur Boronat, Jose A. C., Isidro Ramos, Patrico Letelier  Objective: The definition of Merge operator is applied on class diagrams integration to present an automated approach for generic model merging providing support for conflict resolution and traceability between software artifacts. Keywords: Model-Driven Engineering, Model Management, model merging, conflict resolution.
  • 8. LITERATURE-REVIEW(1/2 Cont..) 8  Introduction:  Models are the main assets in the software development process.  Models collect the information that describes the information system at a high abstraction level, which permits the development of the application in an automated way.  In this process, models constitute software artifacts that experience refinements from the problem space to the solution space.
  • 9. CASE STUDY 9  Use Case Analysis using Partial Class Diagrams:  Case Study - To illustrate how Merge operator can be used effectively to deal with the required needs like inconsistencies or conflicts among partial models which often arises, etc.  Here, part of a system for managing submissions that are received in a conference is presented.  In this example, the focus is on the fragment of the Use-Case Model (Fig. 3).
  • 10. USE CASE MODEL 10 Software development methodologies based on UML propose an approach where the process is Use Case Driven, which means that all artifacts have traceability links from Use Cases (The artifacts are refined through several transformation steps). The Use Case Model must sacrifice precision to facilitate readability and validation. So, the analysis of use cases is mainly a manual activity. Fig. 3: Use Case Model[1]
  • 11. GENERIC SEMANTICS 11  Merge Operator:  The Merge operator takes two models as input and produces a third one.  If A and B are models in a specific meta-model algebraic specification, the application of the Merge operator on them produces a model C, which consists the union of A and B.  Taking into account that duplicates are not allowed in a model, the union is disjoint.
  • 12. LITERATURE-REVIEW(1/2 Cont..) 12  Semantics of the Merge operator needs to introduce three concepts:  The equivalence relation;  The conflict resolution strategy;  The refreshment of a construct. UML CASE tools permit the arrangement of Use Cases and their corresponding partial Class Diagram into the same package, i.e. no option is provided to obtain the global Class Diagram from the partial ones. The Rational Rose Model Integration tool provides an ad-hoc solution to merge UML models. Once the merged model is generated, there is no way to relate the obtained model to the partial source models in order to keep some degree of traceability.
  • 13. LITERATURE-REVIEW(2/2) 13  Title: “Heuristic and pattern based Merge Sort”[2] Author: Manouchehr Zadahmaf jafarlou, Parisa Yousefzadeh fard  Objective: The aim of this study is to present a stable and adaptable Merge Sort algorithm that uses the design patterns to reduce computational complexity of swaps and memory usage.  Keywords: Merge sort, Design patterns, computational complexity.
  • 14. LITERATURE-REVIEW(2/2 Cont..) 14  Introduction:  Although many consider that sorting algorithm is a solved problem, useful new sorting algorithms are still being invented (for example, library sort was first published in 2004).  Sorting algorithms are prevalent in introductory computer science classes, where the abundance of algorithms for the problem provides a gentle introduction to a variety of core algorithm concepts, such as big O notation, divide and conquer algorithms, data structures, best, worst and average case analysis, etc.
  • 15. 15  Sorting algorithms used in computer science are often classified as:  Computational complexity.  Memory usage.  Recursion.  Stability: stable sorting algorithms maintain the relative order of records with equal values.  Whether or not they are a comparison sort. A comparison sort examines the data only by comparing two elements with a comparison operator.  General method: insertion, exchange, selection, merging, etc.  Adaptability: Whether or not the pre sorted-ness of the input affects the running time. CLASSIFICATION
  • 16. LITERATURE-REVIEW(2/2 Cont..) 16  Heuristic and pattern based Merge Sort implementation: Fig. 4. Heuristic and pattern based Merge Sort implementation[2]
  • 17. LITERATURE-REVIEW(2/2 Cont..) 17  First algorithm:  First element of status is the index of first element of next partial array and the second one represent "the number of elements of partial array“ (+1) for ascending partial array or (-1) for descending partial array.  Used when the numbers of arrays are so many that cannot move to volatile memory.  Ex.: Given array -4, -3, 0, 1, 3, 8, 9, 14, 5, 6, 8, 14, 2, 1, -3, 1 ..  if the (-4, -3, 0, 1, 3, 8, 9, 14) be the part of array that sorted before with stMS, (5, 6, 8, 14) will be the next partial ordered array and so the status array is (8, +4).
  • 18. LITERATURE-REVIEW(2/2 Cont..) 18  Second algorithm:  “The first index of first entry of partial arrays" (+1) for ascending arrays and "the first index of first entry of partial arrays" (-1) for descending arrays.  Causes a high performance by eliminating of first steps of merge sort algorithm.  For example for array -8, -4, 0, 4, 3, 1, 0, -2, 5, 7, 9, 10, 5, 4, 2, 1, 3  For status: +1, -4, +8, -12, +15; Partial arrays are indexed as 0->3 (ascending), 4->7 (descending), 8->11 (ascending), 12->14 (descending), 15->15 (ascending). Then status send as argument to stgMS and partial arrays will be the building blocks for stgM algorithm.
  • 19. LITERATURE-REVIEW(2/2 Cont..) 19  Third algorithm:  “The number of partial arrays " (+1) for ascending arrays and "the number of partial arrays" (-1) for descending arrays.  Here, stgMS is a Huffman coding algorithm used to Optimize the merging process by choosing two partial arrays, that sum of elements of them is less than others before each merging.  Then these two partial arrays send as argument to stgM algorithm and merged.
  • 20. PROBLEM STATEMENT 20  When the Use Case Model has many use cases, managing traceability between each use case and the corresponding elements in the resulting class diagram can be a difficult task.  Regarding traceability, this strategy is a sensible solution, but when several team members work in parallel with different use cases, inconsistencies or conflicts among partial models often arise, which must be solved when obtaining the integrated model.
  • 21. CONCLUSION 21  Merge sort is an appropriate algorithm with O(nlgn) Computational complexity, but petitioning of array to one element partial arrays and then merging them cause increasing complexity in time order, system software and hardware work.  The presented algorithm eliminates these extra work using patterns.
  • 22. REFERENCES 22 1. Artur Boronat, Jose A. C., Isidro Ramos, Patrico Letelier,” Formal Model Merging Applied to Class Diagram Integration”, © 2006-Elsevier. 2. Manouchehr Zadahmaf jafarlou, Parisa Yousefzadeh fard,” Heuristic and pattern based Merge Sort”, © 2010-Elsevier. 3. https://www.khanacademy.org/computing/computer-science/algorithms/merge- sort/a/divide-and-conquer-algorithms [09/12/2015, 22:33] 4. http://computationaltales.blogspot.in/2011/10/merge-sort-and-lines-of- kindergarteners.html [09/12/2015, 22:13] 5. http://coding-geek.com/how-databases-work/ [09/12/2015, 22:28]