choosing K elements out of N elements
이전 댓글 표시
Hi,
Is there any function which acts as the following: given a set of n elements, it returns all the k-chosen combinations such that these k elements have at a distance of at most P? For example out of 1:100 we want to chose 5 elements such that they have a maximum distance of 10. how can we do it? btw I need a fast function
Thanks a lot
댓글 수: 2
John D'Errico
2016년 3월 20일
Do you seriously expect that such a code already exists?
First, define what you mean by the word distance. I can think of at least 2 meanings.
As for being fast, everybody wants fast code. I have never actually seen someone say that they explicitly want slow code, or that they don't really care if the code is fast or incredibly slow.
Sepehr Janghorbani
2016년 3월 21일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Conway's Game of Life에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!