Close
Close Window

Chapter 9 Linear Structures

Show Source |    | About   «  9.12. Queues   ::   Contents   ::   9.14. Linear Structure Summary Exercises  »

9.13. Linked Queues

9.13.1. Linked Queues

The linked queue implementation is a straightforward adaptation of the linked list. Here is the linked queue class declaration.


1 / 4 Settings
<<<>>>

Members front and rear are pointers to the front and rear queue elements, respectively.

Created with Raphaël 2.1.2
    null
    5
    Created with Raphaël 2.1.2
    10
    25
    front
    rear
    Proficient Saving... Error Saving
    Server Error
    Resubmit


    1 / 5 Settings
    <<<>>>

    Let's look at how the enqueue operation works.

    Created with Raphaël 2.1.2
      null
      3
      Created with Raphaël 2.1.2
      21
      30
      front
      rear
      Proficient Saving... Error Saving
      Server Error
      Resubmit

      9.13.2. Linked Dequeue

      1 / 8 Settings
      <<<>>>

      Now for the dequeue operation.

      Created with Raphaël 2.1.2
        it
        null
        3
        Created with Raphaël 2.1.2
        21
        30
        front
        rear
        Proficient Saving... Error Saving
        Server Error
        Resubmit

        9.13.3. Comparison of Array-Based and Linked Queues

        All member functions for both the array-based and linked queue implementations require constant time. The space comparison issues are the same as for the equivalent stack implementations. Unlike the array-based stack implementation, there is no convenient way to store two queues in the same array, unless items are always transferred directly from one queue to the other.

        9.13.3.1. Stack and Queue Summary Questions

           «  9.12. Queues   ::   Contents   ::   9.14. Linear Structure Summary Exercises  »

        nsf
        Close Window