docs: clarify dedup_sorted_by_key comment

This commit is contained in:
yongkangc
2026-01-07 02:28:56 +00:00
parent 18468658e9
commit 877ce46915

View File

@@ -83,8 +83,8 @@ fn push_or_update<K: Clone + Eq, V: Clone>(merged: &mut Vec<(K, V)>, entry: &(K,
/// Deduplicates a sorted vector in-place, keeping the last value for each key.
///
/// Uses a classic compaction pattern with read/write pointers. Runs in O(n) time
/// with O(1) extra space.
/// Iterates with a read pointer while a write pointer tracks the compacted output.
/// Runs in O(n) time with O(1) extra space.
#[inline]
fn dedup_sorted_by_key<K: Eq, V>(vec: &mut Vec<(K, V)>) {
if vec.len() <= 1 {