Algorithm to create a linked list from a set of nodes

Posted by user320587 on Stack Overflow See other posts from Stack Overflow or by user320587
Published on 2010-04-29T04:01:57Z Indexed on 2010/04/29 4:07 UTC
Read the original article Hit count: 496

Hi, I am looking for an algorithm to create a linked list from a set of nodes. For example, let's assume a node is an airline ticket from a source point to destination. (e.g., Chicago to Detroit) and there are several airline tickets. Assuming all these airline tickets are jumbled, what is the best way to determine the entire journey path. If there are 5 airline tickets like Chicago->Detroit, Denver->Chicago, Detroit->DC, DC->New York, San Jose->Denver, the algorithm should be able to come up with the correct start to end path.

San Jose -> Denver -> Chicago -> Detroit -> DC -> New York

© Stack Overflow or respective owner

Related posts about algorithm

Related posts about linked-list