| Home | Libraries | People | FAQ | More

## Function nth_element

boost::compute::nth_element

## Synopsis

    // In header: <boost/compute/algorithm/nth_element.hpp>

    template<typename Iterator, typename Compare>
      void nth_element(Iterator first, Iterator nth, Iterator last,
                       Compare compare,
                       command_queue & queue = system::default_queue());
    template<typename Iterator>
      void nth_element(Iterator first, Iterator nth, Iterator last,
                       command_queue & queue = system::default_queue());

## Description

Rearranges the elements in the range [`first`, `last`) such that the `nth` element would be in that position in a sorted sequence.

Space complexity: \Omega(3n)