#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.
On this page of the site you can watch the video online Algorithms in Python | Bubble Sort | Full Code | Telugu with a duration of hours minute second in good quality, which was uploaded by the user Naveen V 19 June 2021, share the link with friends and acquaintances, this video has already been watched 91 times on youtube and it was liked by 1 viewers. Enjoy your viewing!