Skip to content

Fix markdown for normal distribution quicksort #4875

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 8 additions & 25 deletions sorts/normal_distribution_quick_sort.md
Original file line number Diff line number Diff line change
@@ -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.
Comment on lines 3 to +4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not so well written. Could you also improve it?


## Array Elements

The array elements are taken from a Standard Normal Distribution , having mean = 0 and standard deviation 1.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The array elements are taken from a Standard Normal Distribution , having mean = 0 and standard deviation 1.
The array elements are taken from a Standard Normal Distribution, having mean = 0 and standard deviation = 1.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a link to Standard Normal Distribution


#### The code
### The code

```python

>>> import numpy as np
>>> from tempfile import TemporaryFile
>>> outfile = TemporaryFile()
Expand All @@ -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
Expand All @@ -38,27 +34,18 @@ 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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


--
------

## 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
# 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
Expand All @@ -68,8 +55,4 @@ The array elements are taken from a Standard Normal Distribution , having mean =

```


----


------------------
------