Sorting
Sorting
ARRAY
WMSU Members:
BERNALDEZ, SITTI AISA ALBON
CALULUT, JOSHUA MIGUEL CAÑETE
JABONAN, KENNY JAY CELO
MUTALIB, SADAMIER SABUDDIN
SANCHEZ, CAROLINE THERESE GARCIA
SUEÑO, DIANA SANTOS
1
SORTING
• basic techniques used to arrange
elements in a specified order
2
VIDEO PRESENTATION
________________
3
Common Sorting Algorithms
• Bubble sort
• Insertion sort
• Merge sort
4
BUBBLE SORT
5
Bubble Sort
• is a sorting algorithm that compares two
adjacent elements and swaps them until
they are in the intended order.
8
• In each iteration, the
comparison takes place
up to the last unsorted
element.
9
Bubble sort is used if
10
The above illustration can be summarized
in a tabular form
11
INSERTION SORT
12
Insertion Sort
• Insertion sort is an uncomplicated sorting
method that functions much like organizing
playing cards in your hand. It essentially
divides the array into two sections: one
sorted and the other unsorted. Items from
the unsorted segment are chosen and
inserted into their appropriate positions
within the sorted segment.
13
First Pass
14
15
16
17
18
MERGE SORT
19
Merge Sort
• Recursive algorithm
• Divides the list into smaller sublists
• Sorts the sublists
• Merge them afterwards
20
Implementation
• [Insert algorithm here]
21
22