From 43c0afc185812a7013ab8ef90a8ee83c715c4042 Mon Sep 17 00:00:00 2001 From: ashishkore <43812466+ashishkore@users.noreply.github.com> Date: Thu, 31 Oct 2019 21:58:58 +0530 Subject: [PATCH] Create Write a program to print all permutations of a given string --- ...o print all permutations of a given string | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Write a program to print all permutations of a given string diff --git a/Write a program to print all permutations of a given string b/Write a program to print all permutations of a given string new file mode 100644 index 0000000..c83c553 --- /dev/null +++ b/Write a program to print all permutations of a given string @@ -0,0 +1,44 @@ +// C++ program to print all +// permutations with duplicates allowed +#include +using namespace std; + + +// Function to print permutations of string +// This function takes three parameters: +// 1. String +// 2. Starting index of the string +// 3. Ending index of the string. +void permute(string a, int l, int r) +{ + // Base case + if (l == r) + cout<