Click here to Skip to main content
15,920,438 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Saturday programming challenge Pin
Jörgen Andersson15-Nov-14 11:25
professionalJörgen Andersson15-Nov-14 11:25 
GeneralRe: Saturday programming challenge Pin
harold aptroot15-Nov-14 12:04
harold aptroot15-Nov-14 12:04 
GeneralRe: Saturday programming challenge Pin
Jörgen Andersson15-Nov-14 12:15
professionalJörgen Andersson15-Nov-14 12:15 
GeneralRe: Saturday programming challenge Pin
harold aptroot15-Nov-14 12:26
harold aptroot15-Nov-14 12:26 
GeneralRe: Saturday programming challenge Pin
PIEBALDconsult15-Nov-14 14:12
mvePIEBALDconsult15-Nov-14 14:12 
GeneralRe: Saturday programming challenge Pin
BillWoodruff15-Nov-14 16:56
professionalBillWoodruff15-Nov-14 16:56 
GeneralRe: Saturday programming challenge Pin
Jörgen Andersson15-Nov-14 19:31
professionalJörgen Andersson15-Nov-14 19:31 
GeneralRe: Saturday programming challenge Pin
PIEBALDconsult15-Nov-14 19:58
mvePIEBALDconsult15-Nov-14 19:58 
Jörgen Andersson wrote:
if you want to add a ChildNodes property as a part of your solution, I'm interested to see that too


As the records are read from the database, a pair of Dictionary<id,List<id>> indices can be built -- one to hold ancestors, one to hold descendants. Not sure what to do with them yet, but the two ancestor Lists could be compared fairly easily.
Provided the Lists are ordered with the root first, then compare the Lists until you find the first difference, the previous ancestor is the one you want. Similarly, the Intersection of the sets of ancestors is all the common ancesters.

(It's now midnight and I've been actively working on this for an hour so so far.)

modified 16-Nov-14 19:37pm.

GeneralRe: Saturday programming challenge Pin
Jörgen Andersson16-Nov-14 9:02
professionalJörgen Andersson16-Nov-14 9:02 
GeneralRe: Saturday programming challenge Pin
PIEBALDconsult16-Nov-14 10:21
mvePIEBALDconsult16-Nov-14 10:21 
GeneralRe: Saturday programming challenge Pin
Jörgen Andersson16-Nov-14 11:33
professionalJörgen Andersson16-Nov-14 11:33 
GeneralRe: Saturday programming challenge Pin
PIEBALDconsult16-Nov-14 11:55
mvePIEBALDconsult16-Nov-14 11:55 
GeneralRe: Saturday programming challenge Pin
PIEBALDconsult16-Nov-14 16:37
mvePIEBALDconsult16-Nov-14 16:37 
GeneralRe: Saturday programming challenge Pin
Jörgen Andersson16-Nov-14 20:29
professionalJörgen Andersson16-Nov-14 20:29 
GeneralRe: Saturday programming challenge Pin
PIEBALDconsult17-Nov-14 4:05
mvePIEBALDconsult17-Nov-14 4:05 
GeneralRe: Saturday programming challenge Pin
PIEBALDconsult17-Nov-14 13:28
mvePIEBALDconsult17-Nov-14 13:28 
GeneralRe: Saturday programming challenge Pin
PIEBALDconsult16-Nov-14 13:57
mvePIEBALDconsult16-Nov-14 13:57 
GeneralRe: Saturday programming challenge Pin
Jörgen Andersson16-Nov-14 20:20
professionalJörgen Andersson16-Nov-14 20:20 
GeneralRe: Saturday programming challenge Pin
Michael Sisco17-Nov-14 7:14
Michael Sisco17-Nov-14 7:14 
GeneralRe: Saturday programming challenge Pin
Jörgen Andersson17-Nov-14 8:59
professionalJörgen Andersson17-Nov-14 8:59 
JokeNew Tattoo Pin
Mike Hankey15-Nov-14 10:25
mveMike Hankey15-Nov-14 10:25 
GeneralRe: New Tattoo Pin
Oso Oluwafemi Ebenezer17-Nov-14 3:55
Oso Oluwafemi Ebenezer17-Nov-14 3:55 
GeneralRe: New Tattoo Pin
PhilLenoir17-Nov-14 4:33
professionalPhilLenoir17-Nov-14 4:33 
GeneralRe: New Tattoo Pin
Oso Oluwafemi Ebenezer17-Nov-14 5:09
Oso Oluwafemi Ebenezer17-Nov-14 5:09 
GeneralRe: New Tattoo Pin
Gary R. Wheeler21-Nov-14 12:56
Gary R. Wheeler21-Nov-14 12:56 

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.