Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
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
Intuit // C# // listing_4.4 (StreamReader // input.txt)
1. soru
Single Line Date in Months
qw
Unsorted Parallel Arrays finding min & max values.
DN3
Generic Reference constraint
My First Hello world
custom Queue Implementation
First Class