GETNEXTCOMBINATION returns the next K-subset of an N-set. It implements the "Revolving Door" (NEXKSB) algorithm found in "Combinatorial Algorithms", 2nd Ed., by Albert Nijenhuis and Herbert S. Wilf. It is a recursive alternative to the NCHOOSEK command that is extremely fast (O(1)), at the expense of slightly more user interaction. (You do get something that NCHOOSEK does not give you for
this extra effort: see input "m".) Apart from its efficiency, it is awesome because each new K-subset differs from the last by a single element and the last combination generated differs from the first combination by a single element.
引用格式
Jose (2024). A fast NCHOOSEK alternative for engineers who like fast NCHOOSEK alternatives (https://www.mathworks.com/matlabcentral/fileexchange/45165-a-fast-nchoosek-alternative-for-engineers-who-like-fast-nchoosek-alternatives), MATLAB Central File Exchange. 检索时间: .
MATLAB 版本兼容性
平台兼容性
Windows macOS Linux类别
标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!