Click here to Skip to main content
15,897,226 members
Home / Discussions / C#
   

C#

 
QuestionCapturing key presses or key strokes Pin
AndyASPVB23-Oct-09 9:16
AndyASPVB23-Oct-09 9:16 
AnswerRe: Capturing key presses or key strokes Pin
OriginalGriff23-Oct-09 9:28
mveOriginalGriff23-Oct-09 9:28 
GeneralRe: Capturing key presses or key strokes Pin
Lutosław23-Oct-09 9:57
Lutosław23-Oct-09 9:57 
GeneralRe: Capturing key presses or key strokes Pin
AndyASPVB23-Oct-09 10:49
AndyASPVB23-Oct-09 10:49 
GeneralRe: Capturing key presses or key strokes Pin
Anthony Mushrow23-Oct-09 16:54
professionalAnthony Mushrow23-Oct-09 16:54 
AnswerRe: Capturing key presses or key strokes Pin
Henry Minute23-Oct-09 12:38
Henry Minute23-Oct-09 12:38 
GeneralRe: Capturing key presses or key strokes Pin
Rajesh R Subramanian23-Oct-09 23:10
professionalRajesh R Subramanian23-Oct-09 23:10 
GeneralRe: Capturing key presses or key strokes Pin
Henry Minute25-Oct-09 1:10
Henry Minute25-Oct-09 1:10 
GeneralRe: Capturing key presses or key strokes Pin
Rajesh R Subramanian25-Oct-09 1:55
professionalRajesh R Subramanian25-Oct-09 1:55 
GeneralRe: Capturing key presses or key strokes Pin
Henry Minute25-Oct-09 4:40
Henry Minute25-Oct-09 4:40 
AnswerRe: Capturing key presses or key strokes Pin
Rajesh R Subramanian23-Oct-09 23:06
professionalRajesh R Subramanian23-Oct-09 23:06 
QuestionSending a command to an IEnumerable method Pin
Lutosław23-Oct-09 9:13
Lutosław23-Oct-09 9:13 
AnswerRe: Sending a command to an IEnumerable method Pin
Ian Shlasko23-Oct-09 9:55
Ian Shlasko23-Oct-09 9:55 
GeneralRe: Sending a command to an IEnumerable method Pin
Lutosław23-Oct-09 10:27
Lutosław23-Oct-09 10:27 
GeneralRe: Sending a command to an IEnumerable method Pin
Ian Shlasko23-Oct-09 10:38
Ian Shlasko23-Oct-09 10:38 
GeneralRe: Sending a command to an IEnumerable method Pin
Lutosław24-Oct-09 1:01
Lutosław24-Oct-09 1:01 
AnswerRe: Sending a command to an IEnumerable method [modified] Pin
harold aptroot23-Oct-09 10:08
harold aptroot23-Oct-09 10:08 
GeneralRe: Sending a command to an IEnumerable method Pin
Ian Shlasko23-Oct-09 10:33
Ian Shlasko23-Oct-09 10:33 
GeneralRe: Sending a command to an IEnumerable method Pin
harold aptroot23-Oct-09 10:35
harold aptroot23-Oct-09 10:35 
GeneralRe: Sending a command to an IEnumerable method Pin
Ian Shlasko23-Oct-09 10:50
Ian Shlasko23-Oct-09 10:50 
I read through the Wikipedia article... Didn't see the implementation.

Once you actually generate the factoradic number, you still need to grab the items from the array... Like in their example:

Factoradic: 4041000
Array: 0,1,2,3,4,5,6

Step 1: Take element #4 and remove it from the array
Array: 0,1,2,3,5,6 <--- Resized, which would be too slow for an array OR
Array: 0,1,2,3,_,5,6 <--- Marked to skip

Step 2: Take element #0 and remove it
Array: _,1,2,3,_,5,6

Step 3: Take element #4 and remove it
Array: _,1,2,3,_,5,_

Can see the issue in the third step... The #4 element is actually the sixth because we removed two... So you can't just access an array index (First address + (element size x index)), which would be lightning quick... You have to count through the array like you're iterating through a linked list.

So basically, once you generate the factoradic, building the permutation is 6+5+4+3+2+1 (In whatever order) steps, or n(n+1)/2... an O(n^2) operation.

(The only good part about that method is that you can actually use a boolean array to mark the flags and clear it in one memory operation for the next pass)

Then if you're generating ALL possible permutations, it's an O(n^3) operation.

So I'm trying to think of a data structure that would chop that n^2 down a bit.

Proud to have finally moved to the A-Ark. Which one are you in?
Developer, Author (Guardians of Xen)

GeneralRe: Sending a command to an IEnumerable method Pin
harold aptroot23-Oct-09 10:55
harold aptroot23-Oct-09 10:55 
GeneralRe: Sending a command to an IEnumerable method Pin
Ian Shlasko23-Oct-09 11:13
Ian Shlasko23-Oct-09 11:13 
GeneralRe: Sending a command to an IEnumerable method Pin
harold aptroot23-Oct-09 11:19
harold aptroot23-Oct-09 11:19 
GeneralRe: Sending a command to an IEnumerable method Pin
Ian Shlasko23-Oct-09 12:12
Ian Shlasko23-Oct-09 12:12 
GeneralRe: Sending a command to an IEnumerable method Pin
harold aptroot23-Oct-09 12:23
harold aptroot23-Oct-09 12:23 

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.