You are on page 1of 10

Bubblesort

&
Quicksort
Introduction:
In this paper, we’re going to define and briefly explain the Bubblesort and
Quicksort and explores the different uses in real life for each one of these
algorithms.
2

Bubble Sort:
Definition: The simplest sorting algorithm. It involves repetitively sorting the
list. It compares two adjacent elements in the list and swaps them if they are
not in the designated order. It continues until there are no swaps needed.
This is the signal for the list that is sorted. It is also called as comparison sort
as it uses comparisons.[1]

Sort Time Stable In place

Avg Best Worst

Bubble sort O(n2) O(n) O(n2) Yes Yes


Table 1

Since the Bubble sort has been one of the first algorithms Due to its
simplicity, the Bubble sort is often used to introduce the concept of an
algorithm, or a sorting algorithm, to introductory computer science students.
Bubble sort is asymptotically equivalent in running time to insertion sort in
the worst case
Because of that, there are no real-life examples for hardly anything still use
the Bubblesort algorithm
3

Uses for bubble sort:


● Sort Channels
Bubble sorting is used in programming TV to sort channels based on
audience viewing time!
We going to need a database of viewing time for each channel the audience
And the algorithm is going to rearrange the channels the most watched is on
Top and the lease is on the bottom.

● Computer Graphics
In computer graphics, Bubble sorting is quite popular when it comes to
detecting a very small error (like swap of just two elements) in almost-sorted
arrays, like using it in a polygon filling algorithm, where bounding lines are
sorted by their x coordinate at a specific scan line (a line parallel to the x-axis),
and with incrementing y their order changes (two elements are swapped)
only at intersections of two lines.[2]

Figure 1
4

Quicksort:
Quicksort belongs to the divide and conquer category of algorithms. It
depends on the operation of the partition. To partition an array of an element
called a pivot is selected. All elements smaller than the pivots are moved
before it and all greater elements are moved after it. The lesser and greater
sub-lists are then recursively sorted. Efficient implementations of Quicksort
(with in-place partitioning) are typically unstable sorts and somewhat
complex but are among the fastest sorting algorithms in practice.[1]

Sort Time Stable In place

Avg Best Worst

Quick sort O(n logn) O(n logn) O(n2) No Yes


Table 2
5

Uses for Quicksort:


● In Sports:
Sports scores are organized by Quicksort based on the win-loss ratio.
0|3 After 3|0
1|2 After 2|1
2|3 After 3|2
2|4 After 4|2

● Commercial Computing:
Commercial Computing is used in various government and private
organizations for the purpose of sorting various data like sorting files by
name/date/price, sorting of students by their roll no., sorting of account profile
by given id, etc.
6

● Numerical computations:

In scientific research, for accuracy in calculations, most of the efficiently


developed algorithm uses priority queue and quick sort is used for sorting.
For example, we take this paper (A Quicker Method of Using Paired
Comparisons for the Sound Quality Evaluation) that used quicksort (QS) and
mergesort (MS)
“Sorting algorithms were used instead of conventional paired comparison
method in order to reduce the number of pairs in the evaluation of
subjective judgments”[3]
The paper is about a few aspects of aircraft noise.

● In Medical Field:
Example for the Quicksort using in the medical field this paper used the
Quicksort algorithm as a test to evaluate the state group of patients.

BACKGROUND: Sorting tests detect cognitive decline in older adults who


have a neurodegenerative disorder, such as Alzheimerʼs and Parkinsonʼs
disease. Although equally effective at detecting impairment as other
cognitive screens (e.g. Mini-Mental State Examination (MMSE)), sorting tests
are not commonly used in this context. This study examines the QuickSort,
which is a new brief sorting test that is designed to screen older adults for
cognitive impairment.
7

PARTICIPANTS: Older (≥60 years) community-dwelling


Adults (n = 187) and inpatients referred for neuropsychological assessment (n
= 78). A normative subsample (n = 115),
screened for cognitive and psychological disorders, was
Formed from the community sample.

MEASUREMENTS: Participants were administered the QuickSort, MMSE,


Frontal Assessment Battery (FAB), and Depression Anxiety and Stress
Scale-21. The QuickSort requires people to sort nine stimuli by color, shape,
and number, and to explain the basis for their correct sorts. Sorting (range =
0–12), Explanation (range = 0–6), and Total (range = 0–18) scores were
calculated for the QuickSort.

MEASURES: The QuickSort uses nine cards, which are sorted according to
three categories (color, shape, and number) over a maximum of six trials. The
QuickSort Manual, Stimuli, and Record Form are provided in Supplementary
Appendix S2 (Online Supplementary Materials). An early discontinuation rule
reduces administration time when cognition is intact. Three scores are
calculated: (1) a “Sorting” score (named the Category score in other
tests),which aggregates the number of successful sorts, errors (repetition, set
loss, grouping, and completion errors) and prompts during a maximum of six
trials (range = 0–12); (2) an “Explanation” score, which assesses an examineeʼs
ability to explain the basis for their correct sorts (range = 0–6);and (3) a “Total”
score, which sums the Sorting and Explanation scores (range = 0–18). Sorting
scores are used when a person has problems with verbal expression, and both
Sorting and Total scores can be calculated when someone fails to complete
the QuickSort (incomplete trials scored zero). Repetition errors (repeated
sorts using the same rule) and concrete explanations are also recorded for
clinical purposes but are not examined here.
8

CONCLUSION: The QuickSort provides a quick, reliable, and valid alternative


to lengthier cognitive screens (e.g., MMSE and FAB) when screening older
adults for cognitive impairment. The QuickSort performance of an older
adult can be compared with a cognitively healthy normative sample and
used to estimate the likelihood they will be impaired on either the MMSE or
FAB, or both. Clinicians can also use evidence-based modeling to customize
the QuickSort for their setting.[4]

● GPU(graphics card):
For example on using the Quicksort in GPU we have this paper that used
Quicksort algorithm to computations on graphical processors.

The paper’s name is “GPU-Quicksort: A Practical Quicksort Algorithm for


Graphics Processors”.[5]
Introduction: In this paper, we describe GPU-Quicksort, an efficient
Quicksort algorithm suitable for highly parallel multi-core graphics
processors. Quicksort has previously been considered an inefficient sorting
solution for graphics processors, but we show that in CUDA, NVIDIA’s
programming platform for general-purpose computations on graphical
processors, GPU-Quicksort performs better than the fastest known sorting
implementations for graphics processors, such as radix and bitonic sort.
Quicksort can thus be seen as a viable alternative for sorting large quantities
of data on graphics processors.
9

GPU-Quicksort is designed to take advantage of the high bandwidth of


GPUs by
Minimizing the amount of bookkeeping and inter-thread synchronization
needed. It achieves this by:
i) using a two-pass design to keep the inter-thread synchronization low.
ii) coalescing read operations and constraining threads so that memory
accesses are kept to a minimum.
iii)It can also take advantage of the atomic synchronization primitives found
on newer hardware too, when available, further improve its performance.

CONCLUSIONS: In experiments, we compared GPU-Quicksort with some of


the fastest known sorting algorithms for GPUs, as well as with the C++
Standard Library sorting algorithm, Introsort, for reference. We used several
input distributions and two different graphics processors, the low-end
8600GTS with 32 cores and the high-end 8800GTX with 128 cores, both from
NVIDIA. What we could observe was that GPU-Quicksort performed better
on all distributions on the high-end processor and par with or better on the
low-end processor. A significant conclusion, we think, that can be drawn from
this work, is that Quicksort is a practical alternative for sorting large
quantities of data on graphics processors

Results:
In this paper, we discussed uses for each algorithm but in the end, these two
algorithms are old algorithms and have a lot of limitation and drawbacks
when comparing them to other new algorithms like Bubblesort lately its only
been used to introduce the algorithm concept for students and the
Quicksort been active in a certain era but with these new algorithms, it's not
effective even with improvements still.
10

References:
Tables:
Table 1 & Table 2: Aung, H. (2019, August). Analysis and Comparative of Sorting
Algorithms. https://www.ijtsrd.com/papers/ijtsrd26575.pdf.

Figures:
Figure 1:
https://cs.wmich.edu/~yang/teach/cs5270/oldnotes/vanDam/04_4_Scan_Polygon.pdf

[1] Data structure - What is Bubble Sort and Quicksort? (n.d.).


https://www.careerride.com/Data-structure-bubble-quick-sort.aspx.

[2] Das, S. (2021, May 11). Top 10 Sorting Algorithms - Explained with Simple Examples.
Crio Blog. https://www.crio.do/blog/top-10-sorting-algorithms/.

[3] Dickson, C. (2007). A few aspects of aircraft noise (Licentiate dissertation, Farkost
och flyg). Retrieved from http://urn.kb.se/resolve?urn=urn:nbn:se:kth:diva-4510

[4] Foran AM, Mathias JL, Bowden SC. Development of a Brief Screen to Detect
Cognitive Impairment in Older Adults: The QuickSort. J Am Geriatr Soc. 2021
Feb;69(2):441-449. doi: 10.1111/jgs.16898. Epub 2020 Nov 9. PMID: 33165931.

[5] Cederman, D., & Tsigas, P. (2010). GPU-Quicksort: A practical Quicksort algorithm
for graphics processors. ACM J. Exp. Algorithmics, 14.

You might also like