Skip to content

5.3 claims double-ended queue requires doubly-linked list #1641

Open
@j-n-f

Description

@j-n-f

Why does a double-ended queue require a doubly-linked list? This can be implemented with a singly-linked list

  • push front - insert before the head node
  • pop front - remove the head node, point to the following node
  • push back - append to the tail
  • pop back - remove the tail node

In all cases, you maintain a pointer to head and tail.

The only time a doubly-linked list would make sense is if you need to iterate through the entire list front-to-back and back-to-front.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions