apple / swift-algorithms

Commonly used sequence and collection algorithms for Swift
Apache License 2.0
5.9k stars 435 forks source link

The `merge` algorithm for combining sorted collections is missing. #192

Open dabrahams opened 1 year ago

dabrahams commented 1 year ago

See https://cplusplus.com/reference/algorithm/merge/

See also inplace_merge.

mdznr commented 1 year ago

There seems to be a couple of (WIP?) PRs in this space:

https://github.com/apple/swift-algorithms/pull/43 https://github.com/apple/swift-algorithms/pull/184

However, I’m not sure if the Set-like behavior is desirable/necessary in a the basic merge algorithm. For fun, and to start facilitating API discussion, I put up a quick draft PR: https://github.com/apple/swift-algorithms/pull/193