More Permutations

Let's talk about algorithms!

Moderator: Board moderators

Post Reply
bugzpodder
Experienced poster
Posts: 147
Joined: Fri Jun 13, 2003 10:46 pm

More Permutations

Post by bugzpodder »

Suppose we have a string of length n, and we want permutations of length k. how exactly do you do it? can anyone provide with an algorithm (or a name)?

thanks
anupam
A great helper
Posts: 405
Joined: Wed Aug 28, 2002 6:45 pm
Contact:

Post by anupam »


using dfs. or bfs
"Everything should be made simple, but not always simpler"
bugzpodder
Experienced poster
Posts: 147
Joined: Fri Jun 13, 2003 10:46 pm

Post by bugzpodder »

hi anupam,

such a recursive process guarentees that i can generate every permutation of length k using a set of n characters (not necessarly distinct), but what if i want the i-th permutation? is there a simple method to calculate without generating the first i permutations?
abductor
New poster
Posts: 8
Joined: Sat Jan 18, 2003 6:43 pm
Location: Canada

Post by abductor »

Hey bugz!

try to solve problem number 10460
maybe it will give you some ideas
Post Reply

Return to “Algorithms”