Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.
PrevUpHomeNext

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)


PrevUpHomeNext