From c2b7ba3614725011ab5dfd7a74f65b49fb32ecce Mon Sep 17 00:00:00 2001 From: Prateek Chanda Date: Sat, 4 Feb 2017 14:35:30 +0530 Subject: [PATCH] Delete normaldistribution_quicksort_README.md --- normaldistribution_quicksort_README.md | 38 -------------------------- 1 file changed, 38 deletions(-) delete mode 100644 normaldistribution_quicksort_README.md diff --git a/normaldistribution_quicksort_README.md b/normaldistribution_quicksort_README.md deleted file mode 100644 index f90ae1d49..000000000 --- a/normaldistribution_quicksort_README.md +++ /dev/null @@ -1,38 +0,0 @@ -Algorithm implementing QuickSort Algorithm where the pivot element is chosen randomly between first and last elements of the array and the array elements are taken from a Standard Normal Distribution. - -This is different from the ordinary quicksort in the sense, that it applies more to real life problems , where elements usually follow a normal distribution. Also the pivot is randomized to make it a more generic one. - - -#Array Elements - -The array elements are taken from a Standard Normal Distribution , having mean = 0 and standard deviation 1. - -The code - -```python - ->>> import numpy as np ->>> from tempfile import TemporaryFile ->>> outfile = TemporaryFile() ->>> p = 100 # 100 elements are to be sorted ->>> mu, sigma = 0, 1 # mean and standard deviation ->>> X = np.random.normal(mu, sigma, p) ->>> np.save(outfile, X) ->>> print('The array is') ->>> print(X) - -``` - ---------------------- - -#Plotting the function for Checking 'The Number of Swappings' taking place between Normal Distribution QuickSort and Ordinary QuickSort - -```python ->>>import matplotlib.pyplot as plt - - # Normal Disrtibution is red ->>> plt.plot([1,2,4,16,32,64,128,256,512,1024,2048],[1,1,6,15,43,136,340,800,2156,6821,16325],linewidth=2, color='r') - #Simple QuickSort is green ->>> plt.plot([1,2,4,16,32,64,128,256,512,1024,2048],[1,1,4,16,67,122,362,949,2131,5086,12866],linewidth=2, color='g') ->>> plt.show() -```