?
Solved

linked lists help

Posted on 2000-01-20
11
Medium Priority
?
237 Views
Last Modified: 2010-04-16
Having problems implementing circular linked lists.
Let X=(x1,x2,...xn) and  Y=(y1,y2..ym) be two circular linked lists. Need to write a algorithm to merge the two lists together to get linked list
T=(x1,y1,x2,y2...xm,ym,x,{m+1},...xn)if m<n and T=(x1,y1,x2,y2,...,xm,yn,y{n+1},...ym)cannot use any additional nodes.
Explain why this is a good or bad data structure.
0
Comment
Question by:Chloemorgan
  • 6
  • 4
11 Comments
 

Author Comment

by:Chloemorgan
ID: 2371005
Edited text of question.
0
 
LVL 1

Expert Comment

by:FuzzyLogic
ID: 2372699
Hi.

I'll not solve your problem, but I'll give you the direction.
You have two circular linked list, and pointers to the first element.
What you have to do is to save the pointer to the first node of each list, and start passing through the two lists togather. Link them togather by changing the pointers, but always check that you haven't returned to the first node of list. If list Y finished before list X, you don't have even to close the list, as the last element would be xn, and it points to x1.
If the X list ends before the Y list, you have to pass through the Y list in order to close the last node (ym) to x1.

Start implementing this small algorithm, and I'll help you if you got any problems in the code YOU will write.

As for the question (good or bad) you have to answer it yourself, as I've already finished my DataStructures course.

Fuzzy.
0
 
LVL 6

Expert Comment

by:My name is Mud
ID: 2373381
Merge Simpson???

The merge, could be simple...
You have L1 and L2... and want to merge them in to another, i assume you have the Insert procedure, so why don't you "create" the new merged link on the fly using the links allready done...

i mean i don't get it what's the problem, how do you input the data??? with a Insert procedure, right??? well create the Merged link with the same procedure, but insted of inputting by the KB, use the data in the allready links, and swaping each item on each link.
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
LVL 6

Expert Comment

by:My name is Mud
ID: 2378659
Fuzzy fuzzy fuzzy...
0
 
LVL 6

Expert Comment

by:My name is Mud
ID: 2378660
:) opppsss i mean Littlecat littlecat littlecat <so it doesn't sound like a porn threat>... :)
0
 

Author Comment

by:Chloemorgan
ID: 2379587
This question has a deletion request Pending
0
 

Author Comment

by:Chloemorgan
ID: 2379590
I have solved my problem, the rude comments i recieved did not help
thanks
0
 
LVL 6

Expert Comment

by:My name is Mud
ID: 2384174
This question no longer is pending deletion
0
 
LVL 6

Expert Comment

by:My name is Mud
ID: 2384175
>>the rude comments i recieved did not help


The RUDE??? ??? ???

Now i got it, you don't wanna pay, fine, but next time, think about it, you're in my list pal...
0
 
LVL 6

Accepted Solution

by:
My name is Mud earned 200 total points
ID: 2384176
Opppsssss, i meant that as a comment, i mean answer...
0
 

Author Comment

by:Chloemorgan
ID: 2386225
Whatboy, that comment i made was npot referred to you. Sorry if you took it that way. Yes you did help me thanks
0

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The PowerShell Core 6.0 of .NET release is just the beginning. The upcoming PowerShell Core 6.1 would have artificial intelligence and internet of things capabilities. So many things to look forward to in the upcoming release.
You do not need to be a security expert to make the RIGHT security. You just need some 3D guidance, to help lay out an action plan to secure your business operations. It does not happen overnight. You just need to start now and do the first thin…
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…
Suggested Courses

593 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question