官术网_书友最值得收藏!

2. Permutations

A permutation is an ordering of a selection of objects from a set. For example, suppose the set is {apple, banana, cherry}, then the permutations containing two items are all of the orderings of two items selected from that set. Those permutations are {apple, banana}, {apple, cherry}, {banana, apple}, {banana, cherry}, {cherry, apple}, and {cherry, banana}. Notice that {apple, banana} and {banana, apple} contain the same items in different orders.

Write an extension method that returns a List<List<T>>, holding the permutations of a specified length from an array of items. If the specified length is omitted, return all permutations of all lengths.

Write a program similar to the one shown in the following screenshot to test your method:

主站蜘蛛池模板: 光山县| 武定县| 年辖:市辖区| 南和县| 深泽县| 洛川县| 建始县| 青冈县| 和顺县| 郁南县| 德惠市| 武安市| 信宜市| 金门县| 全州县| 井陉县| 湖州市| 河北区| 日照市| 扎囊县| 博湖县| 上饶县| 商丘市| 成武县| 射洪县| 富平县| 双牌县| 平乐县| 调兵山市| 建阳市| 枣强县| 永城市| 讷河市| 忻州市| 凤山县| 武冈市| 陆河县| 渭源县| 温州市| 于都县| 东港市|