#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.
На этой странице сайта вы можете посмотреть видео онлайн Algorithms in Python | Bubble Sort | Full Code | Telugu длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Naveen V 19 Июнь 2021, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 91 раз и оно понравилось 1 зрителям. Приятного просмотра!