|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Concepts | |
| concept | counting_integer |
| Value concept for counting sort. | |
| concept | radix_integer |
| Value concept for radix sort. | |
Typedefs | |
| template<typename IntT > | |
| using | counting_unsigned_t = std::make_unsigned_t< std::remove_cv_t< IntT > > |
| template<typename IntT > | |
| using | radix_unsigned_t = std::make_unsigned_t< std::remove_cv_t< IntT > > |
Functions | |
| template<typename IntT > | |
| size_t | counting_bucket_count (const IntT min_key, const IntT max_key) |
| Compute the number of buckets required for a counting sort range. | |
| template<typename IntT > | |
| size_t | counting_bucket (const IntT value, const IntT min_key) noexcept |
| Map a value to its bucket index in counting sort. | |
| template<typename IntT > | |
| IntT | counting_value_from_bucket (const size_t bucket, const IntT min_key) noexcept |
| Retrieve the original value from a bucket index in counting sort. | |
| template<template< typename > class C, typename IntT > requires counting_integer<IntT> | |
| void | counting_sort_impl (C< IntT > &a) |
| Internal implementation of counting sort for containers. | |
| template<typename IntT > requires counting_integer<IntT> | |
| void | counting_sort_impl (IntT *a, const size_t n) |
| template<typename IntT > requires counting_integer<IntT> | |
| void | counting_sort_impl (DynList< IntT > &list) |
| template<typename IntT > requires counting_integer<IntT> | |
| void | counting_sort_impl (DynDlist< IntT > &list) |
| template<typename IntT > | |
| constexpr radix_unsigned_t< IntT > | radix_key (const IntT value) noexcept |
| template<template< typename > class C, typename IntT > requires radix_integer<IntT> | |
| void | radix_sort_impl (C< IntT > &a) |
| template<typename IntT > requires radix_integer<IntT> | |
| void | radix_sort_impl (IntT *a, const size_t n) |
| Core radix sort implementation for raw pointer ranges. | |
| template<typename IntT > requires radix_integer<IntT> | |
| void | radix_sort_impl (DynList< IntT > &list) |
| LSD radix sort implementation for DynList. | |
| template<typename IntT > requires radix_integer<IntT> | |
| void | radix_sort_impl (DynDlist< IntT > &list) |
| LSD radix sort implementation for DynDlist. | |
| using Aleph::sort_utils_detail::counting_unsigned_t = typedef std::make_unsigned_t<std::remove_cv_t<IntT> > |
Definition at line 4603 of file tpl_sort_utils.H.
| using Aleph::sort_utils_detail::radix_unsigned_t = typedef std::make_unsigned_t<std::remove_cv_t<IntT> > |
Definition at line 4607 of file tpl_sort_utils.H.
|
inlinenoexcept |
Map a value to its bucket index in counting sort.
| IntT | Integer type. |
| value | Value to map. |
| min_key | Minimum key in the range. |
Definition at line 4650 of file tpl_sort_utils.H.
Referenced by counting_sort_impl(), counting_sort_impl(), counting_sort_impl(), and counting_sort_impl().
Compute the number of buckets required for a counting sort range.
| IntT | Integer type. |
| min_key | Minimum value in the range. |
| max_key | Maximum value in the range. |
| ah_domain_error | if max_key < min_key. |
| ah_runtime_error | if the range exceeds size_t capacity. |
Definition at line 4621 of file tpl_sort_utils.H.
References ah_domain_error_if, ah_runtime_error_unless, and Aleph::divide_and_conquer_partition_dp().
Referenced by counting_sort_impl(), counting_sort_impl(), counting_sort_impl(), and counting_sort_impl().
Internal implementation of counting sort for containers.
| C | Container template type. |
| IntT | Integer type. |
| [in,out] | a | Container to sort. |
Definition at line 4682 of file tpl_sort_utils.H.
References Aleph::count(), counting_bucket(), counting_bucket_count(), Aleph::Array< T >::create(), Aleph::divide_and_conquer_partition_dp(), and k.
Referenced by Aleph::counting_sort(), Aleph::counting_sort(), Aleph::counting_sort(), Aleph::counting_sort(), and Aleph::counting_sort().
Definition at line 4806 of file tpl_sort_utils.H.
References Aleph::count(), counting_bucket(), counting_bucket_count(), counting_value_from_bucket(), Aleph::Array< T >::create(), Aleph::divide_and_conquer_partition_dp(), Aleph::DynDlist< T >::Iterator::get_curr_ne(), Aleph::Dlink::Iterator::has_curr(), k, Aleph::DynDlist< T >::Iterator::next_ne(), and Aleph::DynDlist< T >::size().
Definition at line 4761 of file tpl_sort_utils.H.
References Aleph::count(), counting_bucket(), counting_bucket_count(), counting_value_from_bucket(), Aleph::Array< T >::create(), Aleph::divide_and_conquer_partition_dp(), Aleph::DynList< T >::Iterator::get_curr_ne(), Aleph::HTList::Iterator::has_curr(), k, Aleph::HTList::Iterator::next_ne(), and Aleph::HTList::size().
Definition at line 4722 of file tpl_sort_utils.H.
References Aleph::count(), counting_bucket(), counting_bucket_count(), Aleph::Array< T >::create(), Aleph::divide_and_conquer_partition_dp(), and k.
|
inlinenoexcept |
Retrieve the original value from a bucket index in counting sort.
| IntT | Integer type. |
| bucket | Bucket index. |
| min_key | Minimum key in the range. |
Definition at line 4667 of file tpl_sort_utils.H.
References Aleph::divide_and_conquer_partition_dp().
Referenced by counting_sort_impl(), and counting_sort_impl().
|
constexprnoexcept |
Definition at line 4851 of file tpl_sort_utils.H.
References Aleph::divide_and_conquer_partition_dp().
Definition at line 4864 of file tpl_sort_utils.H.
References Aleph::count(), Aleph::Array< T >::create(), and Aleph::divide_and_conquer_partition_dp().
Referenced by Aleph::radix_sort(), Aleph::radix_sort(), Aleph::radix_sort(), Aleph::radix_sort(), and Aleph::radix_sort().
LSD radix sort implementation for DynDlist.
Performs a stable radix sort on a doubly-linked list.
| IntT | Integer type. |
| [in,out] | list | The doubly-linked list to sort. |
Definition at line 5003 of file tpl_sort_utils.H.
References Aleph::Array< T >::append(), Aleph::divide_and_conquer_partition_dp(), Aleph::Dnode< T >::get_data(), Aleph::Dnode< T >::remove_first_ne(), Aleph::Array< T >::reserve(), and Aleph::DynDlist< T >::size().
LSD radix sort implementation for DynList.
Performs a stable radix sort on a linked list. This implementation is memory efficient as it reuses the original list nodes.
| IntT | Integer type. |
| [in,out] | list | The list to sort. |
Definition at line 4963 of file tpl_sort_utils.H.
References Aleph::Array< T >::append(), Aleph::divide_and_conquer_partition_dp(), Aleph::HTList::is_empty(), Aleph::Array< T >::reserve(), and Aleph::HTList::size().
Core radix sort implementation for raw pointer ranges.
Uses counting sort as a stable subroutine to sort by each byte digit.
| IntT | Integer type. |
| [in,out] | a | Pointer to the array. |
| [in] | n | Number of elements. |
Definition at line 4914 of file tpl_sort_utils.H.
References Aleph::count(), Aleph::Array< T >::create(), and Aleph::divide_and_conquer_partition_dp().