quickselectFS_demo

quickselectFS_demo illustrates the functioning of quickselectFS

Syntax

  • kE=quickselectFS_demo(A,k)example
  • kE=quickselectFS_demo(A,k,kiniindex)example

Description

example

kE =quickselectFS_demo(A, k) quickselectFS_demo with all default options.

example

kE =quickselectFS_demo(A, k, kiniindex)

Examples

expand all

  • quickselectFS_demo with all default options.
  • rng('default');
    rng(12345);
    n=15;
    Y=1:n; Y=shuffling(Y);
    k=7;
    [out]=quickselectFS_demo(Y,k);
    % Check the result
    sorY=sort(Y);
    disp([out,sorY(k)])
         7     7
    
    
    Click here for the graphical output of this example (link to Ro.S.A. website).

    Input Arguments

    expand all

    A — a set of unique numbers. Vector.

    Vector containing a set of n (distinct) numbers.

    Data Types: single| double

    k — order statistic index. Scalar.

    An integer between 1 and n indicating the desired order statistic.

    Data Types: double

    Optional Arguments

    kiniindex — Index of an element in A. Scalar.

    The index of an element in A that is supposed to be "close" to the desired k-th order statistic. This information is used to choose the pivot so that the chance to fall into the worst case performance ($O(n^2)$) is minimized and the average case performance is maximized.

    Example: 'kiniindex',1

    Data Types: double

    Output Arguments

    expand all

    kE —k-th order statistic. Scalar

    Element in A that is larger than exactly k - 1 other elements of A.

    References

    Azzini, I., Perrotta, D. and Torti, F. (2023), A practically efficient fixed-pivot selection algorithm and its extensible MATLAB suite, "arXiv, stat.ME, eprint 2302.05705"

    See Also

    This page has been automatically generated by our routine publishFS