Click here to Skip to main content
15,885,757 members
Home / Discussions / C#
   

C#

 
AnswerRe: sorting information from several threads - is my algorithm correct? Pin
John Torjo17-Nov-15 14:03
professionalJohn Torjo17-Nov-15 14:03 
AnswerRe: sorting information from several threads - is my algorithm correct? Pin
BillWoodruff17-Nov-15 14:49
professionalBillWoodruff17-Nov-15 14:49 
GeneralRe: sorting information from several threads - is my algorithm correct? Pin
John Torjo17-Nov-15 14:59
professionalJohn Torjo17-Nov-15 14:59 
GeneralRe: sorting information from several threads - is my algorithm correct? Pin
BillWoodruff18-Nov-15 0:05
professionalBillWoodruff18-Nov-15 0:05 
GeneralRe: sorting information from several threads - is my algorithm correct? Pin
John Torjo18-Nov-15 0:07
professionalJohn Torjo18-Nov-15 0:07 
GeneralRe: sorting information from several threads - is my algorithm correct? Pin
John Torjo18-Nov-15 10:58
professionalJohn Torjo18-Nov-15 10:58 
AnswerRe: sorting information from several threads - is my algorithm correct? Pin
Gerry Schmitz17-Nov-15 16:13
mveGerry Schmitz17-Nov-15 16:13 
GeneralRe: sorting information from several threads - is my algorithm correct? Pin
John Torjo17-Nov-15 22:12
professionalJohn Torjo17-Nov-15 22:12 
Depends what you mean by control Smile | :)

Not sure if having a Concurrent dictionary would help. The problem is that what I return as "latest" should be sorted correctly at all times. The client should not have to re-sort his existing list after each call to get the "latest" - that would defeat its purpose.

To give you an example with numbers (instead of dates), and 3 threads:

A: 1,7,20
B: 2,3,15
C: 4,8

At this point, I can safely return {1,2,3,4,7}, and we'll have

A: 20
B: 15
C: 8

At this point, say I get two more numbers:

A: 20,25
B: 15,17
C: 8


Here, I can't return anything, because I'm not sure what will come after 8. Say I wait a bit and then have:

A: 20,25
B: 15,17
C: 8,16,21

Right now I can return {8,15,16}, and will still have

A: 20,26
B: 17
C: 21


(note: I can't return 20, since I'm not sure what will come next on B)
I wait a bit and have

A: 20,26
B: 17,18
C: 21,23


Right now I can only return {17}. I can't return nor 20, nor 21, because I'm not sure what will come next on B.

Best,
John
-- LogWizard Meet the Log Viewer that makes monitoring log files a joy!

GeneralRe: sorting information from several threads - is my algorithm correct? Pin
Gerry Schmitz18-Nov-15 0:17
mveGerry Schmitz18-Nov-15 0:17 
GeneralRe: sorting information from several threads - is my algorithm correct? Pin
John Torjo18-Nov-15 0:23
professionalJohn Torjo18-Nov-15 0:23 
GeneralRe: sorting information from several threads - is my algorithm correct? Pin
Gerry Schmitz18-Nov-15 0:50
mveGerry Schmitz18-Nov-15 0:50 
GeneralRe: sorting information from several threads - is my algorithm correct? Pin
John Torjo18-Nov-15 4:10
professionalJohn Torjo18-Nov-15 4:10 
AnswerRe: sorting information from several threads - is my algorithm correct? Pin
Daniel Pfeffer18-Nov-15 9:24
professionalDaniel Pfeffer18-Nov-15 9:24 
GeneralRe: sorting information from several threads - is my algorithm correct? Pin
John Torjo18-Nov-15 10:38
professionalJohn Torjo18-Nov-15 10:38 
QuestionNeed help with creating of program Pin
F1nger17-Nov-15 5:01
F1nger17-Nov-15 5:01 
AnswerRe: Need help with creating of program Pin
OriginalGriff17-Nov-15 5:12
mveOriginalGriff17-Nov-15 5:12 
GeneralRe: Need help with creating of program Pin
F1nger17-Nov-15 5:16
F1nger17-Nov-15 5:16 
GeneralRe: Need help with creating of program Pin
OriginalGriff17-Nov-15 5:20
mveOriginalGriff17-Nov-15 5:20 
GeneralRe: Need help with creating of program Pin
F1nger17-Nov-15 5:20
F1nger17-Nov-15 5:20 
GeneralRe: Need help with creating of program Pin
OriginalGriff17-Nov-15 5:26
mveOriginalGriff17-Nov-15 5:26 
AnswerRe: Need help with creating of program Pin
Pete O'Hanlon17-Nov-15 5:14
mvePete O'Hanlon17-Nov-15 5:14 
GeneralRe: Need help with creating of program Pin
F1nger17-Nov-15 5:17
F1nger17-Nov-15 5:17 
GeneralRe: Need help with creating of program Pin
Dave Kreskowiak17-Nov-15 6:40
mveDave Kreskowiak17-Nov-15 6:40 
GeneralMaking Application a Trial Version Pin
Member 1202173416-Nov-15 22:29
Member 1202173416-Nov-15 22:29 
GeneralRe: Making Application a Trial Version Pin
Richard MacCutchan16-Nov-15 22:40
mveRichard MacCutchan16-Nov-15 22:40 

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.