Programming in Python
31 followers -

31 followers
Posts
Post has attachment
Python Program to find LCM of 2 numbers.

LCM means Least Common Multiple, for a given 2 numbers we need to find the least common multiple for them.

Let's take an example of 3 and 5, here I will find the LCM of those 2 numbers.

Multiples of 3: 3, 6, 9, 12, 15, 18, 21, 24...

Multiples of 5: 5, 10, 15, 20, 25, 30....

Now we find the first number which is found in both the multiples and it is clear that 15 is that number, and the LCM(3, 5) will be 15.

Post: https://programminginpython.com/lcm-two-numbers-python-program/
GitHub: https://github.com/avinashn/programminginpython.com/blob/master/lcm_python.py

Website: https://programminginpython.com
Github: https://github.com/avinashn/programminginpython.com
Medium: https://medium.com/programminginpython-com
Post has attachment
How to implement Quick Sort Algorithm in Python.

A simple python program which implements QuickSort Algorithm.

Quicksort is a divide and conquer algorithm and is a much more efficient algorithm than the previous algorithms discussed Bubble Sort(https://www.youtube.com/watch?v=AthG28-_RuM) and Selection Sort(https://www.youtube.com/watch?v=5PjDmeNwoOE).

Quicksort when implemented well it is one of the best sorting algorithms, In fact, the sort function provided in most of the language libraries is the implementation of Quicksort itself.

Time Complexity of QuickSort:
Best Case O(n log n)
Average Case O(n log n)
Worst Case O(n2)

Post: https://programminginpython.com/quick-sort-algorithm-python
GitHub: https://git.io/fAnr0

Website: http://programminginpython.com
Github: https://github.com/avinashn/programminginpython.com
Medium: https://medium.com/programminginpython-com
Post has attachment
How to implement Insertion Sort Algorithm in Python.

A simple python program which implements Insertion Sort Algorithm.

Insertion sort is an in-place sorting algorithm and is a much more efficient algorithm than the previous algorithms discussed Bubble Sort(https://www.youtube.com/watch?v=AthG28-_RuM) and Selection Sort(https://www.youtube.com/watch?v=5PjDmeNwoOE).

Here a sub-list is maintained which always sorted, as the iterations go on, the sorted sub-list grows until all the elements are sorted.

Time Complexity of Insertion Sort:
Best Case O(n2)
Average Case O(n)
Worst Case O(n2)

Post: https://programminginpython.com/insertion-sort-algorithm-python/
GitHub: https://git.io/vpBD0
Medium: https://medium.com/programminginpython-com/insertion-sort-algorithm-in-python-688d9eb02399

Website: http://programminginpython.com
Github: https://github.com/avinashn/programminginpython.com
Medium: https://medium.com/programminginpython-com
Post has attachment
A Python TKInter GUI domain to IP converter app. This basically takes a valid domain name as input and returns its corresponding IP address.

Python socket module is used here to do this networking and give the domain to IP conversion.

Here I use TKinter's widgets like Frames, Labels, Buttons, EntryFields.
Used Grid geometry manager and covers about centering all the elements in the window using weights for row and columns.

Post: https://programminginpython.com/domain-to-ip-converter-python-gui-tkinter/
GitHub: https://git.io/vANdY

Website: http://programminginpython.com
Github: https://github.com/avinashn/programminginpython.com
Medium: https://medium.com/programminginpython-com
Post has attachment
How to implement Merge Sort Algorithm in Python.

A simple python program which implements Merge Sort Algorithm. Merge sort is much more efficient algorithm than previous 2 algorithms discussed Bubble sort(https://www.youtube.com/watch?v=AthG28-_RuM) and Selection Sort(https://www.youtube.com/watch?v=5PjDmeNwoOE).

Time Complexity of Merge Sort:
Best Case O(n log n)
Average Case O(n log n)
Worst Case O(n log n)

Post: https://programminginpython.com/merge-sort-algorithm-python
GitHub: https://git.io/vANdY

Website: http://programminginpython.com
Github: https://github.com/avinashn/programminginpython.com
Medium: https://medium.com/programminginpython-com
Post has attachment
How to implement Selection Sort Algorithm in Python.

A simple python program which implements selection sort algorithm in python.

A selection sort is one of the simplest sorting technique, wherein this sorting technique the smallest element is placed at the beginning of the list and the rest elements are sorted, and this continues until all the elements are sorted

Time Complexity of Selection Sort:
Best Case O(n2)
Average Case O(n2)
Worst Case O(n2)

Post: https://programminginpython.com/selection-sort-algorithm-python
GitHub: https://git.io/vAqj1

Website: http://programminginpython.com
Github: https://github.com/avinashn/programminginpython.com
Medium: https://medium.com/programminginpython-com
Post has attachment
How to implement Bubble Sort Algorithm in Python.

A simple python program which implements bubble sort algorithm in python.

A bubble sort is one of the simplest sorting technique, wherein this sorting technique the adjacent elements are compared and sorted, the same process is repeated until all the elements in the list are sorted.

Time Complexity of Bubble Sort:
Best Case O(n)
Average Case O(n2)
Worst Case O(n2)

Post: https://programminginpython.com/bubble-sort-algorithm-python
GitHub: https://git.io/vAfsF

Website: http://programminginpython.com
Github: https://github.com/avinashn/programminginpython.com
Medium: https://medium.com/programminginpython-com
Post has attachment
Set datatype in Python, a program in python which explains the various operations on sets and implements those set operations like intersection, union, difference, removing an element from a set, finding the length of the set and all other operations with a simple example.

Post: https://programminginpython.com/python-set-operations/
GitHub: https://git.io/vNaF9

Website: http://programminginpython.com
Github: https://github.com/avinashn/programminginpython.com
Medium: https://medium.com/programminginpython-com
Post has attachment
A simple python program to implement a Binary Search algorithm.

Here in this technique, the list must be sorted. I find start, end, and mid elements of the list.
Check if mid element is equal to element to be searched, if yes returns the position of the mid element or if mid is greater or lesser changes the start or end values as needed and follows the same approach for that smaller lists

Time Complexity:
Best Case O(1)
Average Case O(log n)
Worst Case O(log n)

Post: http://programminginpython.com/binary-search-algorithm-python
GitHub: https://github.com/avinashn/programminginpython.com/blob/master/Algorithms/Search%20Algorithms/binary_search.py

Website: http://programminginpython.com
Github: https://github.com/avinashn/programminginpython.com
Medium: https://medium.com/programminginpython-com
Post has attachment
A simple python program to implement a Linear Search algorithm.

Here in this technique, we compare each and every element with the key element to be found, if both of them matches, the algorithm returns that element is found and its position.

Time Complexity:
Best Case O(1)
Average Case O(n)
Worst Case O(n)

Post: http://programminginpython.com/python-program-linear-search-algorithm
GitHub: https://github.com/avinashn/programminginpython.com/blob/master/Algorithms/Search%20Algorithms/linear_search.py

Website: http://programminginpython.com