Full Project On BubbleSort Algorithm
Full Project On BubbleSort Algorithm
Full Project On BubbleSort Algorithm
Information Systems
CC4002NA
Coursework 1
CC4002NA ..................................................................................................................... 1
Coursework 1 ................................................................................................................ 1
Figure 1: Flowchart..................................................................................................... 3
Table of Tables
Bubble sort algorithm is a sorting technique in which we sort the given elements
in ascending or descending order by comparing two elements at a time and
placing them in correct position. (dyclassroom.com, 2017)
Example:
First Pass
(6 1 9 3 5) (1 6 9 3 5) Algorithm swaps values because 6>1
(1 6 9 3 5) (1 6 9 3 5) Algorithm doesn’t swap values because 6<9
(1 6 9 3 5) (1 6 3 9 5) Algorithm swaps values because 9>3
(1 6 3 9 5) (1 6 3 5 9) Algorithm swaps values because 9>5
Table 1: First Pass in Bubble sort algorithm
Second Pass
(1 6 3 9 5) (1 6 3 9 5) Algorithm doesn’t swap values because 1<6
(1 6 3 9 5) (1 3 6 9 5) Algorithm swaps values because 3<6
(1 3 6 9 5) (1 3 6 9 5) Algorithm doesn’t swap values because 6<9
(1 3 6 9 5) (1 3 6 5 9) Algorithm swaps values because 9>5
Table 2: Second Pass in Bubble sort algorithm
Third Pass
(1 3 6 5 9) (1 3 6 5 9) Algorithm doesn’t swap values because 1<3
(1 3 6 5 9) (1 3 6 5 9) Algorithm doesn’t swap values because 3<6
(1 3 6 5 9) (1 3 5 6 9) Algorithm swaps values because 6 > 5
(1 3 5 6 9) (1 3 5 6 9) Algorithm doesn’t swap values because 6<9
Table 3: Third Pass in Bubble sort algorithm
Fourth Pass
(1 3 5 6 9) (1 3 5 6 9) Doesn’t Swap
(1 3 5 6 9) (1 3 5 6 9) Doesn’t Swap
(1 3 5 6 9) (1 3 5 6 9) Doesn’t Swap
(1 3 5 6 9) (1 3 5 6 9) Doesn’t Swap
Table 4: Fourth Pass in Bubble sort algorithm
Since in the fourth pass no values were swapped, all of the values are in ascending
order. This is how values are sorted by Bubble sort algorithm.
Saugat Timilsina 1
CC4002NA Information System
Saugat Timilsina 2
CC4002NA Information System
Saugat Timilsina 3
CC4002NA Information System
3. Data Structures
There are four collection data types available in python. Although all of them
are collection data types, they are used for storing different types of data for
different purposes. They are:
a. List: A list is a collection data type that can contain elements of
different data types or can be empty too. For Example:
myList = {4, 5, 6, 7}
b. Tuple: Tuple is alike list but it is immutable, so we cannot replace or
delete any of their items. For Example:
tupleEx = {s, a, u, g, a, t}
c. Dictionaries: Dictionary is unordered collection of key-value that have
pair with unique keys and are mutable. For Example:
details = {‘name’ = saugat, ‘district’ = tanahun, ‘level’ = 12}
d. Set: Set is an unordered collection of elements. They are mutable but
unordered. For Example:
setEx = {‘t’, ‘i’, ‘m’, ‘i’ ,’l’, ‘s’, ‘i’, ‘n’, ‘a’}
(lecturer, 2017)
Saugat Timilsina 4
CC4002NA Information System
4. Conclusion
I was curious about how websites, software worked and what the development
cycle is like since my high school days. So, I searched about it on the web and got
to know about website development. After that I started learning about HTML, CSS
and JS through online tutorials. I became familiar about how softwares and
computers worked through the online courses. After I saw various python projects,
I was fascinated by various Python projects. Then, I looked up about what was the
most we could get out of programming with Python. After that, I began watching
tutorials online for Python 2 and understood the concepts like variables, data types
and OOP concept. Thus, I would say my curiosity got me started and it has been
helpful when our module started.
Since, I had already been watching online tutorials and getting help from
huge online community, it was a bit exaggerating at first and I expected that it would
be hard for me to grasp all concepts at college due to the vastness of the possibility
of things we could do and make with the help of Python. I had not gone deep in the
basics of python but had made key loggers and automated email sender with the
help of Python community and various libraries. Since, I thought it would be vast
and I might not be able to grasp all the concepts, it is going smooth till now.
It has been
exciting grabbing the new concepts and vast possibility ahead and I am willing to
learn more to be able to contribute something for both the Python and social
community. I would say the journey of programming with Python until now has
been amazing and am able to manage, cope up with it. The only thing that bugs
me in programming is our module is mostly based on hard code and not on things
that our current world is shifting towards. This might be because I have seen
fascinating stuffs like python controlled smart mirror and IOT being made in vlogs
but I hope some exciting things like those should also be included in our course as
extra credit stuffs.
Saugat Timilsina 5
CC4002NA Information System
Bibliography
1) dyclassroom.com. (2017, 12 26). Bubble Sort Algorithm. Retrieved from
dyclassroom.com: dyclassroom.com/sorting-algorithm/bubble-sort
2) Unknown. (2017, 12 28). Collection data types. Lecture Slide. Lecturer .
Saugat Timilsina 6