From 4391b3b2b5b8599209d71a12078f801f69c76c21 Mon Sep 17 00:00:00 2001 From: Roboam Casanova Castro Date: Fri, 1 Oct 2021 16:48:52 -0500 Subject: [PATCH 1/2] Fix some Markdown conventions - MD001/heading-increment/header-increment: Heading levels should only increment by one level at a time - MD012/no-multiple-blanks: Multiple consecutive blank lines - MD026/no-trailing-punctuation: Trailing punctuation in heading - MD035/hr-style: Horizontal rule style - MD045/no-alt-text: Images should have alternate text (alt text) Conventions from https://github.com/DavidAnson/markdownlint/blob/v0.24.0/doc/Rules.md --- sorts/normal_distribution_quick_sort.md | 31 ++++++------------------- 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/sorts/normal_distribution_quick_sort.md b/sorts/normal_distribution_quick_sort.md index 2a9f77b3ee95..cc943d7f338c 100644 --- a/sorts/normal_distribution_quick_sort.md +++ b/sorts/normal_distribution_quick_sort.md @@ -1,18 +1,15 @@ # Normal Distribution QuickSort - 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. - +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 +### The code ```python - >>> import numpy as np >>> from tempfile import TemporaryFile >>> outfile = TemporaryFile() @@ -22,12 +19,11 @@ The array elements are taken from a Standard Normal Distribution , having mean = >>> np.save(outfile, X) >>> print('The array is') >>> print(X) - ``` ------ -#### The Distribution of the Array elements. +### The Distribution of the Array elements ```python >>> mu, sigma = 0, 1 # mean and standard deviation @@ -38,26 +34,17 @@ The array elements are taken from a Standard Normal Distribution , having mean = ``` +------ ------ - - - - -![](https://www.mathsisfun.com/data/images/normal-distrubution-large.gif) - ---- - ---------------------- +![normal distribution large](https://www.mathsisfun.com/data/images/normal-distrubution-large.gif) --- +------ ## Plotting the function for Checking 'The Number of Comparisons' taking place between Normal Distribution QuickSort and Ordinary QuickSort ```python >>>import matplotlib.pyplot as plt - # Normal Disrtibution QuickSort 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') @@ -68,8 +55,4 @@ The array elements are taken from a Standard Normal Distribution , having mean = ``` - ----- - - ------------------- +------ From 7e1fdfe208c208c038f3cfbd7dd7c8d877f36227 Mon Sep 17 00:00:00 2001 From: Roboam Casanova Date: Mon, 18 Oct 2021 23:54:24 -0500 Subject: [PATCH 2/2] Update sorts/normal_distribution_quick_sort.md Co-authored-by: John Law --- sorts/normal_distribution_quick_sort.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sorts/normal_distribution_quick_sort.md b/sorts/normal_distribution_quick_sort.md index cc943d7f338c..d1bfb8bce507 100644 --- a/sorts/normal_distribution_quick_sort.md +++ b/sorts/normal_distribution_quick_sort.md @@ -45,7 +45,7 @@ The array elements are taken from a Standard Normal Distribution , having mean = ```python >>>import matplotlib.pyplot as plt - # Normal Disrtibution QuickSort is red +# Normal Disrtibution QuickSort 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') #Ordinary QuickSort is green