#pythonintelugu #PythonAlgorithms #naveenv
Algorithms in Python | Bubble Sort |Telugu | Naveen V
Time complexity is the computational complexity that describes the amount of computer time it takes to run an algorithm. Time complexity is commonly estimated by counting the number of elementary operations performed by the algorithm
Time Complexity is commonly expressed using big O notation, typically O(n), O (logn), O(n^2), O(2^n), O(n!) etc where n is the input size in units of bits needed to represent the input.
Time Codes:
00:00 - Why do we need Sorting?
03:05 - Binary Search Logarithmic Time
05:00 - Common Time Complexities
08:45 - Bubble Sort Pseudo Example
11:10 - Python Code Implementation Bubble Sort
15:23 - Bubble Sort Worst Case Time Complexity
16:36 - Step through inner working using print
Code -
list_num = [9999, 44, 33, 22, 11, 0, 66, -11, 46, 123, 17]
def bubble_sort(list_num):
""" DOC STRING:
Bubble sort function takes an unsorted list as input and returns
sorted list
Time complexity is O(n^2)
"""
count = 0
for i in range(len(list_num)):
for j in range(len(list_num) - i - 1):
if list_num[j] "GREATER THAN (change symbol)" list_num[j + 1]:
list_num[j], list_num[j + 1] = list_num[j + 1], list_num[j]
count += 1
print(f"i: {i}, j: {j},{list_num},Swap: {count}")
return list_num
print(bubble_sort(list_num))
print(help(bubble_sort))
If you like this content, please like, share and subscribe. Motivates me to create more such content.
Sur cette page du site, vous pouvez voir la vidéo en ligne Algorithms in Python | Bubble Sort | Full Code | Telugu durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Naveen V 19 juin 2021, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 91 fois et il a aimé 1 téléspectateurs. Bon visionnage!