Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

mwittstrom

Question about linked lists.

This topic is 5386 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have two dubble-linked lists where the objects contain a ID variable. What is the fastest way to get all the ID''s that is in both both lists. The lists aren''t sorted on the ID. (The lists are the result of dimension reduction.) Ex: List 1: a-h-e-p-q-x List 2: x-w-a-y-s Result: a and x

Share this post


Link to post
Share on other sites
Advertisement
I would probably implement a binary tree and insert the IDs of the two lists along with a counter in each node. Assuming your lists cant have duplicate IDs you could then traverse the tree afterwards and the matches would be the nodes having the counter > 1.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!