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
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.