Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 761333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:49:31+00:00 2026-05-14T15:49:31+00:00

I am looking for an algorithm to create a linked list from a set

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T15:49:31+00:00Added an answer on May 14, 2026 at 3:49 pm

    If you are guaranteed that the nodes will form a single path (ie, maximum indegree is 1, maximum outdegree is 1, exactly one node has indegree 0, exactly one node has outdegree 0), then you could do the following:

    • Construct two hashes: in_cities and out_cities
    • For every node A -> B, add it to in_cities with key A and out_cities with key B
    • Pick a node arbitrarily, call it S
    • Have curr point to S. While the source city of curr is in out_cities, insert the corresponding node in the beginning of the path. Update curr to point to this node.
    • Have curr point to S. While the destination city of curr is in in_cities, add the corresponding node to the end of the path. Update curr to point to this node.

    Now you are done, in linear time with respect to the total number of cities.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 523k
  • Answers 523k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The Ruby plugin does include all the features of RubyMine,… May 16, 2026 at 9:37 pm
  • Editorial Team
    Editorial Team added an answer If your target is 3.2 or higher, you can use… May 16, 2026 at 9:37 pm
  • Editorial Team
    Editorial Team added an answer The Windows binaries generally work for every mini release for… May 16, 2026 at 9:37 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I am looking for a hash-algorithm, to create as close to a unique hash
I'm looking for a quick method/algorithm for finding which nodes in a graph is
I'm looking for an algorithm to solve the following in a reasonable amount of
I'm looking for the description of an algorithm that can be used to decompress
I'm looking to create a blob in a computationally fast manner. A blob here
I'm looking for information about the well-known Damas-Hindley-Milner algorithm to do type inference for
I'm attempting to create an order number for customers to use. I will have
I have a set of 3d points that approximate a surface. Each point, however,
I'm looking to build a pseudo Gantt chart, except one where events can be
I will try to explain what I want to accomplish. I am looking for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.