Crate slice_reduce

Crate slice_reduce 

Source
Expand description

§切片工具库/Slice Utilities

提供高效的切片操作函数/Provides efficient slice operations

§功能/Features

  • 分块/Chunking
  • 搜索/Searching
  • 统计/Counting
  • 排序相关/Sorting utilities

Functions§

binary_search
二分查找/Binary search (要求数组已排序/Array must be sorted)
chunk
将数组分块/Chunk an array into smaller arrays
count
统计元素出现次数/Count element occurrences
count_by
按指定键函数统计元素出现次数/Count elements by key function
dedup_sorted
已排序数组去重/Remove duplicates from sorted array
linear_search
线性搜索/Linear search
longest_common_prefix
查找字符串数组的最长公共前缀/Longest common prefix of strings
max_subarray_sum
最大子数组和(Kadane算法)/Maximum subarray sum (Kadane’s algorithm)
merge_sorted
合并两个已排序数组合并保持顺序/Merge two sorted arrays
repeat_fill
用模式重复填充数组/Repeat pattern to fill array
reverse
反转数组/Reverse an array
shuffle
随机打乱数组/Randomly shuffle array (Fisher-Yates算法/Fisher-Yates algorithm)
slice_cmp
切片比较(类似字典序)/Slice comparison (lexicographical order)
sliding_window_max
滑动窗口最大值/Sliding window maximum
split_at_checked
安全的分割切片/Safely split slice at index