From a3ab980816b4d5471c8c055f7ee99bfaf8e16d22 Mon Sep 17 00:00:00 2001 From: Prateek Chanda Date: Fri, 3 Feb 2017 22:02:05 +0530 Subject: [PATCH] random_normaldistribution_quicksort This is for creating an 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. --- sorts/random_normaldistribution_quicksort.py | 66 ++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 sorts/random_normaldistribution_quicksort.py diff --git a/sorts/random_normaldistribution_quicksort.py b/sorts/random_normaldistribution_quicksort.py new file mode 100644 index 000000000..19b180578 --- /dev/null +++ b/sorts/random_normaldistribution_quicksort.py @@ -0,0 +1,66 @@ +from random import randint +from tempfile import TemporaryFile +import numpy as np +import math + + + +def _inPlaceQuickSort(A,start,end): + count = 0 + if start