Skip to content

Commit

Permalink
Update insertionSorting.py
Browse files Browse the repository at this point in the history
  • Loading branch information
SujataSaurabh authored Sep 28, 2018
1 parent e07d419 commit 03ad1a1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dataStructuresinPython/insertionSorting.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# @SuGo, 31 July 2018
# Insertion sorting algorithm
# Bubble sorting algorithm
# In this sorting, every single value is compared with the rest of the values one by one. Hence, the complexity depends on the size of the input to be sorted.
# Complexity:: Best case -- O(n) and Worst case -- O(n^2)
#
# -----------------
def insertionSort(A):
'''
This code follows the bubble sort algorithm. Do not consider the algo as of the insertion sorting
'''
xrange = range
for i in xrange(1, len(A)):
for j in xrange(i, 0, -1):
Expand Down

0 comments on commit 03ad1a1

Please sign in to comment.