asd

  Copy


More Options: Make a Folding Card




Storyboard Description

This storyboard does not have a description.

Storyboard Text

  • Cons: More Costly to Enqueue / Dequeue
  • a
  • 0
  • Naïve array-based queues only need max size
  • b
  • 1
  • c
  • 2
  • d
  • 3
  • Pros: Avoids Rightward Drift which occurs in naïve array-based queues
  • Now let's dequeue the first item...
  • 0
  • b
  • 1
  • c
  • 2
  • d
  • 3
  • Pros: Avoids Rightward Drift which occurs in naïve array-based queues
  • Reason: Items stuck at the end of queue (Rightward Drift)
  • There is no more space after the previous item. We cannot enqueue anymore items, even though there are empty spaces in the queue
  • 0
  • b
  • 1
  • c
  • 2
  • d
  • 3
  • 4
  • We can also specify which item do dequeue
  • 3
  • e
  • 5
  • f
  • d
  • q.dequeue("d") will check each slot from front to back before deleting the item
  • c
  • j
  • is this "d"?
  • b
  • 0
  • 2
  • is this "d"?
  • 1
  • Front = 1 Back = 0
  • 4
  • 3
  • e
  • Once "d" is found, that item is deleted from the queue
  • 5
  • Found "d"!
  • f
  • d
  • Front = 1 Back = 0
  • c
  • j
  • 2
  • b
  • 0
  • 1
  • 4
  • 3
  • e
  • 5
  • f
  • c
  • j
  • 2
  • b
  • 0
  • 1
  • 3
  • d
  • If there are multiple items with the same value to be dequeued, only the first from the front is dequeued
  • 5
  • Found "d"!
  • d
  • d
  • Front = 1 Back = 0
  • c
  • j
  • 2
  • b
  • 0
  • 1
  • 4
  • 3
  • d
  • 5
  • d
  • c
  • j
  • 2
  • b
  • 0
More Storyboards By bruceweekee
Explore Our Articles and Examples

Try Our Other Websites!

Photos for Class – Search for School-Safe, Creative Commons Photos! (It Even Cites for You!)
Quick Rubric – Easily Make and Share Great Looking Rubrics!