[ 
https://issues.apache.org/jira/browse/ARROW-7400?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Micah Kornfield resolved ARROW-7400.
------------------------------------
    Fix Version/s: 1.0.0
       Resolution: Fixed

Issue resolved by pull request 6039
[https://github.com/apache/arrow/pull/6039]

> [Java] Avoids the worst case for quick sort
> -------------------------------------------
>
>                 Key: ARROW-7400
>                 URL: https://issues.apache.org/jira/browse/ARROW-7400
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: Java
>            Reporter: Liya Fan
>            Assignee: Liya Fan
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.0.0
>
>          Time Spent: 3h 40m
>  Remaining Estimate: 0h
>
> This issue is in response of a discussion in: 
> https://github.com/apache/arrow/pull/5540#discussion_r329487232.
> The quick sort algorithm can degenerate to an O(n^2) algorithm, if the pivot 
> is selected poorly. This is an important problem, as the worst case can 
> happen, if the input vector is alrady sorted, which is frequently encountered 
> in practice.
> After some investigation, we solve the problem with a simple but effective 
> approach: take 3 samples and choose the median (with at most 3 comparisons) 
> as the pivot. This sorts the vector which is already sorted in O(nlogn) time. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to