Linked list and queue

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kay

    #1

    Linked list and queue

    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 ?

  • Victor Bazarov

    #2
    Re: Linked list and queue

    Kay wrote:[color=blue]
    > I would like to ask a question about linked list and queue.
    > 1) Can each node of linked list contain a queue ?[/color]

    Yes.
    [color=blue]
    > 2) Is it the same queue or different queue ?[/color]

    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

    Comment

    • Karl Heinz Buchegger

      #3
      Re: Linked list and queue

      Kay wrote:[color=blue]
      >
      > I would like to ask a question about linked list and queue.
      > 1) Can each node of linked list contain a queue ?[/color]

      Sure. A node of a linked list can contain anything.
      [color=blue]
      > 2) Is it the same queue or different queue ?[/color]

      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.

      --
      Karl Heinz Buchegger
      kbuchegg@gascad .at

      Comment

      Working...