arrays - How to find the kth smallest element of a list without sorting the list? -
i need find median of array without sorting or copying array.
the array stored in shared memory of cuda program. copying global memory slow program down , there not enough space in shared memory make additional copy of there.
i use 2 'for' loops , iterate on every possible value , count how many values smaller o(n^2). not ideal
does of o(n) or o(nlogn) algorithm solves problem?
thanks.
if input integers absolute value smaller c, there's simple o(n log c) algorithm needs constant additional memory: binary search answer, i.e. find smallest number x such x larger or equal @ least k elements in array. it's parallelizable via parallel prefix scan counting.
Comments
Post a Comment