please give me a code of multiple linked queue in data structure using c++

Recommended Answers

All 9 Replies

First off, we don't do other people's homework for them. Second, we don't do other people's homework for them. And third, we don't do other people's homework for them. Sensing a pattern here yet?

No one here will simply hand you a solution on a silver platter. If you show us what you've done, what you've tried to do, and what problems you've had with it, then we'll be happy to help. If you have specific questions, we can answer them, or at least point you in the right direction. If you have a program with a bug you can't swat on your own, we'll be glad to assist, so long as you pay attention to the forum rules and post sensible questions in an intelligent manner that we have some reasonable hope of answering.

But just cutting and pasting an assignment into a message, without even prefacing it with something like, "I have this homework problem that I can't solve...", is likely to get you booted from the message boards here and elsewhere - if you're lucky. What happens to you if you are unlucky is... well... let's just say that this guy probably won't be trying that again, on that forum or this one.

And if you think you won't get caught by your professor... think again.

We take this issue seriously here. Very seriously. Asking us to do homework for you is a grave breach of academic ethics on your part, and actually doing so would be an even bigger breach on ours (not that this stops the many fine mercenaries at Freelancer.com, but still). Simply posting this here, in this way, could get you expelled from your school, if someone happens to notice it and blow the whistle on you. Furthermore, it does neither you nor us any good to help you cheat - especially since there's a good chance some day one of us will have to work with you, manage you, or, Eris forefend, fix code you've written. We have an obligation to our profession and our own future sanity to help you become a good programmer, and doing your coursework for you isn't going to do that.

And please don't insult our intelligence by claiming that it isn't a class assignment. It's very easy to spot one, and we have a lot of practice at it. Trust me on this.

Now, if you actually don't know how to create a program that fits the requirements... hmmmn. Reading the book is definitely called for. As is speaking to the professor; while some can be a--holes about office hours, most are more than willing to give extra help, if only to keep their class grades from slipping to the point where they get re-assigned to teach remedial basketweaving.

What do you mean by "multiple linked"?

2 different queue each has its own value so how can we linked these 2 queues?

Are you talking about a queue of queues, or perhaps a tree of some kind (which from some points of view can be seen as a list of lists)? Please try to be as clear as possible about what you need. If this is an assignment, please post the assignment description, so we can see what it is you are trying to accomplish.

Mind you, as I said earlier, we aren't going to just give you the program whole cloth; we can advise you, but we won't do the work for you. We will need a clear understanding of your project if we are to help you, however.

this is the assignment question
1. Create multiple queues as number of word in the input string. Each word has a queue, which is
created on the character. At the end concatenate all queues.

Example:
String = “Data Structure and Algorithms”
Q1 = D a t a
Q2 = S t r u c t u r e
Q3 = a n d
Q4 = A l g o
At the end
Q1 Q2 Q3 Q4

at the end q1->q2->q3->q4->

OK, that does clarify things a good deal. Basically, you want a list whose elements are themselves list of characters. This is fairly easy to do, fortunately.

I assume that using the STL list<> template is out of the question, so I would start by defining the node structure or class for the inner lists. If you have already covered templates (unlikely), you could design a generic node class and use that; otherwise, you would probably start with something like this:

struct CharNode 
{
    char data;
    CharNode* next;
}

If you want, this can be a simple POD (plain old data) structure, as shown above, since it doesn't really have any behavior of its own. However, it may make sense to have it as a class, just for uniformity if nothing else. The other node class would be very similar:

struct QueueNode 
{
    CharNode* queue;
    QueueNode* next;
}

As you can see, these are still only singly-linked lists, they are just nested one inside the other.

The real meat of the project is in the list classes, which are just a head pointer to the first node of the list, and the methods which insert, display and delete the elements of the list(s).

and i case of array implimentation?

i am facing problem in insertion at front in linked list kindly help me.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.