Click here to Skip to main content
15,922,315 members
Home / Discussions / C#
   

C#

 
AnswerRe: where is the site that i can download msdn for visual 2005? Pin
Rajesh Anuhya28-Apr-10 21:12
professionalRajesh Anuhya28-Apr-10 21:12 
QuestionHow to Remove Sharing Permission of a Folder through c# Pin
himuskanhere28-Apr-10 18:37
himuskanhere28-Apr-10 18:37 
AnswerRe: How to Remove Sharing Permission of a Folder through c# Pin
Md. Marufuzzaman28-Apr-10 21:37
professionalMd. Marufuzzaman28-Apr-10 21:37 
QuestionPass ctrl + c to a process (console application) from another app/service Pin
Spunky Coder28-Apr-10 15:21
Spunky Coder28-Apr-10 15:21 
AnswerRe: Pass ctrl + c to a process (console application) from another app/service Pin
PIEBALDconsult28-Apr-10 16:11
mvePIEBALDconsult28-Apr-10 16:11 
AnswerRe: Pass ctrl + c to a process (console application) from another app/service Pin
#realJSOP29-Apr-10 1:49
professional#realJSOP29-Apr-10 1:49 
QuestionCombinations Pin
James Towers28-Apr-10 10:59
James Towers28-Apr-10 10:59 
AnswerRe: Combinations Pin
Luc Pattyn28-Apr-10 11:54
sitebuilderLuc Pattyn28-Apr-10 11:54 
Hi,

1.

that is one of those rare problems that is handled well by using recursion. Basically you need to implement a single method that appends in turn each conceivable fraction of a combination to what you already have, then calls itself for the remainder of the job description.

Example: assuming you already have "A1" call yourself with argument "[8B]XY[TL]"; getting "[8B]" now, you foreach the possibilities, adding them to the result string, calling yourself again with "XY[TL]"

You could simply output the results or add them to a collection.

One advantage of recursion is you will get all possibilities in a nice predictable order.

2.

there is an alternate tactic provided the number of combinations is representable as an integer number.
It goes like this:
a. assume the variable substrings have P1, P2, ... Pp length
a. calculate the number of combinations N, i.e. the product of P1*P2*...*Pp as you stated;
b. loop an integer J from 0 to N-1
c. divide J by P1, use the remainder as the index in the leftmost possibilities string
d. divide the quotient by P2, use the remainder again as an index in the second possibilities string
etc.

The advantage here is all combinations are ordered again (different from the first method though), and you can simply calculate the K-th combination without calculating all the preceeding ones first.

Smile | :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]

Prolific encyclopedia fixture proof-reader browser patron addict?
We all depend on the beast below.


AnswerRe: Combinations Pin
PIEBALDconsult28-Apr-10 14:07
mvePIEBALDconsult28-Apr-10 14:07 
GeneralRe: Combinations Pin
James Towers28-Apr-10 14:29
James Towers28-Apr-10 14:29 
GeneralRe: Combinations Pin
PIEBALDconsult28-Apr-10 16:25
mvePIEBALDconsult28-Apr-10 16:25 
AnswerRe: Combinations Pin
Luc Pattyn28-Apr-10 14:45
sitebuilderLuc Pattyn28-Apr-10 14:45 
GeneralRe: Combinations Pin
James Towers28-Apr-10 15:20
James Towers28-Apr-10 15:20 
GeneralRe: Combinations Pin
Luc Pattyn28-Apr-10 15:28
sitebuilderLuc Pattyn28-Apr-10 15:28 
AnswerRe: Combinations Pin
PIEBALDconsult28-Apr-10 19:20
mvePIEBALDconsult28-Apr-10 19:20 
QuestionDisplay a PDF in a Windows C# program. Pin
jbradshaw28-Apr-10 10:57
jbradshaw28-Apr-10 10:57 
QuestionRe: Display a PDF in a Windows C# program. Pin
AspDotNetDev28-Apr-10 21:02
protectorAspDotNetDev28-Apr-10 21:02 
AnswerRe: Display a PDF in a Windows C# program. Pin
Kythen29-Apr-10 7:26
Kythen29-Apr-10 7:26 
GeneralRe: Display a PDF in a Windows C# program. Pin
jbradshaw30-Apr-10 7:45
jbradshaw30-Apr-10 7:45 
QuestionCross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on repair doesnt work Pin
igalep13228-Apr-10 9:04
igalep13228-Apr-10 9:04 
AnswerRe: Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on repair doesnt work Pin
Not Active28-Apr-10 9:12
mentorNot Active28-Apr-10 9:12 
GeneralRe: Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on repair doesnt work Pin
igalep13228-Apr-10 9:25
igalep13228-Apr-10 9:25 
GeneralRe: Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on repair doesnt work Pin
Not Active28-Apr-10 9:40
mentorNot Active28-Apr-10 9:40 
GeneralRe: Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on repair doesnt work Pin
igalep13228-Apr-10 9:48
igalep13228-Apr-10 9:48 
GeneralRe: Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on repair doesnt work Pin
Not Active28-Apr-10 10:21
mentorNot Active28-Apr-10 10:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.