PCL
Sorting Algorithms

## Functions

template<class RI >
void pcl::HeapSort (RI i, RI j)

template<class RI , class BP >
void pcl::HeapSort (RI i, RI j, BP p)

template<class BI >
void pcl::InsertionSort (BI i, BI j)

template<class BI , class BP >
void pcl::InsertionSort (BI i, BI j, BP p)

template<class RI >
void pcl::QuickSort (RI i, RI j)

template<class RI , class BP >
void pcl::QuickSort (RI i, RI j, BP p)

template<class BI >
void pcl::Sort (BI i, BI j)

template<class BI , class BP >
void pcl::Sort (BI i, BI j, BP p)

## Detailed Description

Template formal parameters:

FI Forward iterator
BI Bidirectional iterator
RI Random access iterator
UP Unary predicate
BP Binary predicate
T Item type
F Function

## ◆ HeapSort() [1/2]

template<class RI >
 void pcl::HeapSort ( RI i, RI j )
inline

Generic heap sort algorithm.

Sorts a range [i,j) in ascending order by the heap sort algorithm. Ordering of elements is defined such that for any pair a, b of elements in [i,j) a < b is true if a precedes b.

Definition at line 420 of file Sort.h.

References pcl::ItemType().

Referenced by pcl::HeapSort(), and pcl::Sort().

## ◆ HeapSort() [2/2]

template<class RI , class BP >
 void pcl::HeapSort ( RI i, RI j, BP p )
inline

Generic heap sort algorithm.

Sorts a range [i,j) in ascending order by the heap sort algorithm. Ordering of elements is defined such that for any pair a, b of elements in [i,j) the binary predicate p(a,b) is true if a precedes b.

Definition at line 494 of file Sort.h.

References pcl::HeapSort(), pcl::InsertionSort(), pcl::ItemType(), and pcl::QuickSort().

## ◆ InsertionSort() [1/2]

template<class BI >
 void pcl::InsertionSort ( BI i, BI j )
inline

Generic insertion sort algorithm.

Sorts a range [i,j) in ascending order by the insertion sort algorithm. Ordering of elements is defined such that for any pair a, b of elements in [i,j) a < b is true if a precedes b.

Definition at line 117 of file Sort.h.

References pcl::ItemType().

Referenced by pcl::HeapSort(), and pcl::Sort().

## ◆ InsertionSort() [2/2]

template<class BI , class BP >
 void pcl::InsertionSort ( BI i, BI j, BP p )
inline

Generic insertion sort algorithm.

Sorts a range [i,j) in ascending order by the insertion sort algorithm. Ordering of elements is defined such that for any pair a, b of elements in [i,j) the binary predicate p(a,b) is true if a precedes b.

Definition at line 155 of file Sort.h.

References pcl::ItemType().

## ◆ QuickSort() [1/2]

template<class RI >
 void pcl::QuickSort ( RI i, RI j )
inline

Generic quick sort algorithm.

Sorts a range [i,j) in ascending order by the quick sort algorithm (median of three variant). Ordering of elements is defined such that for any pair a, b of elements in [i,j) a < b is true if a precedes b.

Definition at line 250 of file Sort.h.

References pcl::ItemType().

## ◆ QuickSort() [2/2]

template<class RI , class BP >
 void pcl::QuickSort ( RI i, RI j, BP p )
inline

Generic quick sort algorithm.

Sorts a range [i,j) in ascending order by the quick sort algorithm (median of three variant). Ordering of elements is defined such that for any pair a, b of elements in [i,j) the binary predicate p(a,b) is true if a precedes b.

Definition at line 346 of file Sort.h.

References pcl::ItemType().

## ◆ Sort() [1/2]

template<class BI >
 void pcl::Sort ( BI i, BI j )
inline

Generic sort algorithm.

Sorts a range [i,j) in ascending order. Ordering of elements is defined such that for any pair a, b of elements in [i,j) a < b is true if a precedes b.

This function sorts the specified input sequence employing the fastest (known) sorting algorithm for the iterator class BI. Insertion sort is used for bidirectional iterators without random access, and the quick sort algorithm (median of three variant) is used for random access iterators.

If you want to use the heap sort algorithm instead of quick sort (e.g. for performance testing purposes), define the __PCL_PREFER_HEAPSORT macro.

Definition at line 534 of file Sort.h.

References pcl::HeapSort(), pcl::InsertionSort(), pcl::IteratorClass(), and pcl::QuickSort().

## ◆ Sort() [2/2]

template<class BI , class BP >
 void pcl::Sort ( BI i, BI j, BP p )
inline

Generic sort algorithm.

Sorts a range [i,j) in ascending order. Ordering of elements is defined such that for any pair a, b of elements in [i,j) the binary predicate p(a,b) is true if a precedes b.

This function sorts the specified input sequence employing the fastest (known) sorting algorithm for the iterator class BI. Insertion sort is used for bidirectional iterators without random access, and the quick sort algorithm (median of three variant) is used for random access iterators.

If you want to use the heap sort algorithm instead of quick sort (e.g. for performance testing purposes), define the __PCL_PREFER_HEAPSORT macro.

Definition at line 575 of file Sort.h.

References pcl::IteratorClass().