Linked list and queue

K

Kay

I would like to ask a question about linked list and queue.
1) Can each node of linked list contain a queue ?
2) Is it the same queue or different queue ?
 
V

Victor Bazarov

Kay said:
I would like to ask a question about linked list and queue.
1) Can each node of linked list contain a queue ?
Yes.

2) Is it the same queue or different queue ?

If it's a simple std::list<std::queue>, then it's a different
queue in every list node. If it's std::list<std::queue*>, then
it's a different pointer that might point to the same queue...

Your questions are quite vague. Be more specific next time, OK?

V
 
K

Karl Heinz Buchegger

Kay said:
I would like to ask a question about linked list and queue.
1) Can each node of linked list contain a queue ?

Sure. A node of a linked list can contain anything.
2) Is it the same queue or different queue ?

Different queues. That is: each node has its own queue

You can arrange for all nodes to share the same queue by
having the queue extern to all nodes and storing pointers
to this queue within the nodes.

So in a nutshell: You are the programmer. You decide how
things should work in your program.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top