Bubble Sort Algorithm - Algorithm - Flowchart - Data Structures
Bubble Sort Algorithm - Algorithm - Flowchart - Data Structures
net/publication/343601648
CITATIONS READS
0 3,234
1 author:
Dipak Kandel
London Metropolitan University
3 PUBLICATIONS 0 CITATIONS
SEE PROFILE
All content following this page was uploaded by Dipak Kandel on 12 August 2020.
2.1. Algorithm
Before going to the flowchart, let’s understand the algorithm of the bubble sort. So
the step by step algorithm of the bubble sort algorithm is given below:
3.1. Lists
List is the ordered collection data type with ordered sequence of data information
which are accessed according to their index value. List can have any numbers and any
type of items. Index value starts from 0 to list length – 1. Lists are mutable data structures
so that the list values can be added, removed, or simply changed even after the list is
defined and created. List can contain arbitrary objects, lists can be nested and are
Dynamic. Indexing in list can be run negatively i.e. the last element inside the list can be
accessed by the index value -1. List use Square Brackets [] to initialize. Following are
some examples of functions in lists. (Sturtz, 2018)
Print(list[0])
o Output = 1
Print(list[-1])
o Output = 5
list.append (6) #add element to the end of
3.2. Tuples
Tuples are quiet identical to lists in python. Tuples are defined by enclosing the
elements in parenthesis () instead of square brackets. Tuples are immutable data types
in python. Tuples are ordered, can contain arbitrary objects. Tuples can be indexed sliced
and can be nested as in lists. Tuples can be created with zero items represented by blank
(). Following are some examples of tuples and some functions on it. (Sturtz, 2018)
Tuple1 = (“ram”, “35”, “Monday”, “2.5”) #Declaring a tuple and initializing elements.
Output = tommy
3.4. Sets
A set is an unordered collection of items. Sets are used to perform mathematical
operations like union, intersection, Symmetric difference, etc. To create a set, we use curly braces
{}. Elements are placed inside curly braces and separate by a comma. Set can be of mixed data
types. Set does not support changing of an element of set by using indexing or slicing. Some of
the examples of sets are given below. (Anon., n.d.)
Print (set1.intersection(set2))
String1 = “hello_World”
print (String1)
Output = hello_World