目录

fast_utils_algorithm.h

Overview

General-purpose algorithm utility header file, currently providing data structures and function definitions related to sorting.

File to include: <FASTKit/fast_utils_algorithm.h>

Library: libfast_utils.so

System capability: SystemCapability.FAST.Core

Since: 26.0.0

Related module: FAST

Summary

[h2]Structs

Name Description
struct HMS_FAST_SortData Describes a contiguous memory data block to be sorted.

[h2]Type Definitions

Name Description
typedef struct HMS_FAST_SortData HMS_FAST_SortData Describes a contiguous memory data block to be sorted.
typedef void* HMS_FAST_SortElementPtr Opaque pointer type of a single element in a generic container.
typedef const void* HMS_FAST_SortElementConstPtr Const opaque pointer type of a single element in a generic container.
typedef int32_t(*HMS_FAST_Sort_CompFunc) (HMS_FAST_SortElementConstPtr first, HMS_FAST_SortElementConstPtr second) Defines the callback function pointer type for a custom comparison function.

[h2]Functions

Name Description
FAST_ErrorCode HMS_FAST_Algo_Sort (HMS_FAST_SortData *data, HMS_FAST_Sort_CompFunc comp) Fully sorts an array of arbitrary type using a custom comparison function.
FAST_ErrorCode HMS_FAST_Algo_PartialSortAt (HMS_FAST_SortData *data, size_t offset, size_t count, HMS_FAST_Sort_CompFunc comp) Performs an in-place partial sort on an array, making the specified range correspond to a sorted segment.
FAST_ErrorCode HMS_FAST_Algo_NaturalSort (HMS_FAST_SortData *data, int32_t ascend) Sorts an array of UTF-8 strings using natural language rules.
FAST_ErrorCode HMS_FAST_Algo_NaturalPartialSortAt (HMS_FAST_SortData *data, size_t offset, size_t count, int32_t ascend) Partially sorts an array of UTF-8 strings using natural language rules, making the specified range correspond to a sorted segment.