added stubs for remaining median algorithms
This commit is contained in:
parent
f072f162b2
commit
3b6d9f349f
3
MedianOfMedians.h
Normal file
3
MedianOfMedians.h
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
// https://en.wikipedia.org/wiki/Median_of_medians
|
14
RandomizedSelect.h
Normal file
14
RandomizedSelect.h
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Anmerkung: code funktioniert!
|
||||||
|
|
||||||
|
RANDOMIZED-SELECT(A,p,r,i)
|
||||||
|
if (p==r) then return A[p]
|
||||||
|
q=RANDOMIZED_PARTITION(A,p,r) //Pivot Element A[q]
|
||||||
|
k=q-p+1 //Anzahl Elemente A[p..q]
|
||||||
|
if (i==k) then return A[q] //Pivot ist das gesuchte
|
||||||
|
elseif (i<k)
|
||||||
|
then return RANDOMIZED-SELECT(A,p,q-1,i)
|
||||||
|
else return RANDOMIZED-SELECT(A,q+1,r,i-k)
|
||||||
|
*/
|
Loading…
x
Reference in New Issue
Block a user