Month: March 2021

Python Example – Write a Python program to sort a list of elements using Gnome sort

(Python Example for Citizen Data Scientist & Business Analyst)   Write a Python program to sort a list of elements using Gnome sort Gnome sort is a sorting algorithm originally proposed by Dr. Hamid Sarbazi-Azad (Professor of Computer Engineering at Sharif University of Technology) in 2000 and called “stupid sort” (not to be confused with …

Python Example – Write a Python program to sort a list of elements using Bogosort sort

(Python Example for Citizen Data Scientist & Business Analyst) Write a Python program to sort a list of elements using Bogosort sort. In computer science, Bogosort is a particularly ineffective sorting algorithm based on the generation and test paradigm. The algorithm successively generates permutations of its input until it finds one that is sorted. It …

Python Example – Write a Python code to create a program for Bitonic Sort

(Python Example for Citizen Data Scientist & Business Analyst)   Write a Python code to create a program for Bitonic Sort.   Bitonic Sort: According to rutgers.edu – Bitonic sort is a comparison-based sorting algorithm that can be run in parallel. It focuses on converting a random sequence of numbers into a bitonic sequence, one …

Python Example – Write a Python program Program for counting sort

(Python Example for Citizen Data Scientist & Business Analyst)   Write a Python program Program for counting sort.   According to Wikipedia “In computer science, counting sort is an algorithm for sorting a collection of objects according to keys that are small integers; that is, it is an integer sorting algorithm. It operates by counting …

Python Example – Write a Python program to sort a list of elements using the quick sort algorithm

(Python Example for Citizen Data Scientist & Business Analyst)   Write a Python program to sort a list of elements using the quick sort algorithm. Note : According to Wikipedia “Quicksort is a comparison sort, meaning that it can sort items of any type for which a “less-than” relation (formally, a total order) is defined. …

Python Example – Write a Python program to sort a list of elements using the quick sort algorithm

(Python Example for Citizen Data Scientist & Business Analyst)   Write a Python program to sort a list of elements using the quick sort algorithm. Note : According to Wikipedia “Quicksort is a comparison sort, meaning that it can sort items of any type for which a “less-than” relation (formally, a total order) is defined. …

Python Example – Write a Python program to sort a list of elements using the merge sort algorithm

(Python Example for Citizen Data Scientist & Business Analyst)   Write a Python program to sort a list of elements using the merge sort algorithm.   Note: According to Wikipedia “Merge sort (also commonly spelled mergesort) is an O (n log n) comparison-based sorting algorithm. Most implementations produce a stable sort, which means that the …

Python Example – Write a Python program to sort a list of elements using shell sort algorithm

(Python Example for Citizen Data Scientist & Business Analyst)   Write a Python program to sort a list of elements using shell sort algorithm. Note : According to Wikipedia “Shell sort or Shell’s method, is an in-place comparison sort. It can be seen as either a generalization of sorting by exchange (bubble sort) or sorting …

Python Example – Write a Python program to sort a list of elements using the insertion sort algorithm.

(Python Example for Citizen Data Scientist & Business Analyst)   Write a Python program to sort a list of elements using the insertion sort algorithm. Note: According to Wikipedia “Insertion sort is a simple sorting algorithm that builds the final sorted array (or list) one item at a time. It is much less efficient on …

Python Example – Write a Python program to sort a list of elements using the selection sort algorithm

(Python Example for Citizen Data Scientist & Business Analyst)   Write a Python program to sort a list of elements using the selection sort algorithm. Note : The selection sort improves on the bubble sort by making only one exchange for every pass through the list.   Sample Solution: Python Code: def selectionSort(nlist): for fillslot in range(len(nlist)-1,0,-1): …