Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
Permutations of string
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { private static void Swap(ref char a, ref char b) { if (a == b) return; a ^= b; b ^= a; a ^= b; } public static void GetPer(char[] list) { int x = list.Length - 1; GetPer(list, 0, x); } private static void GetPer(char[] list, int k, int m) { if (k == m) { Console.Write(list); Console.Write(" "); } else for (int i = k; i <= m; i++) { Swap(ref list[k], ref list[i]); GetPer(list, k + 1, m); Swap(ref list[k], ref list[i]); } } public static void Main(string[] args) { string str = "sagiv"; char[] arr = str.ToCharArray(); GetPer(arr); } } }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
hackton
LabExer2-RCA
Xml in C#
Compiler
Sort String
Main5
Intuit // C# // listing_4.7 (case // calculator)
SafeSquareRoot.java
Chris Kasongo Lazarius Mukengeshayi "Entelect BlackJack 21"
Lesson 2
stackse - search stackoverflow differently
Please log in to post a comment.