Recursive Algorithm for output in full Arrangement

Source: Internet
Author: User

When I click Weibo in the morning, I can see all the input via the program. If I find that I haven't written it, I can't. Check the information.
The explanation on Baidu encyclopedia is to replace the current Index with the subsequent Index until the end!

// Convert the specified subscript in the array to private static void (char [] charlist, int left, int right) {var m = charlist [left]; charlist [left] = charlist [right]; charlist [right] = m;} private static void recursion (char [] charlist, int index, int length) {if (index = length-1) // output the current order at the end of the access list {for (int I = 0; I <charlist. length; I ++) {Console. write (charlist [I]);} Console. writeLine ();} else {// access list for (int I = inde X; I <length; I ++) {if (I! = Index) {Exchange (charlist, index, I);} recursion (charlist, index + 1, length); if (I! = Index) {Switch (charlist, index, I );}}}}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.