DSA 2

  Copy


More Options: Make a Folding Card




Storyboard Description

This storyboard does not have a description.

Storyboard Text

  • We will now run the dequeue operation which will remove a value from the front of the queue
  • q.dequeue
  • This value will be removed
  • 4
  • e
  • 4
  • 3
  • d
  • c
  • a
  • b
  • 2
  • 0
  • 1
  • First value has been removed from the queue
  • Current attributes: Front = 1 Back = 4 Count = 4
  • 4
  • 5
  • e
  • 3
  • d
  • c
  • 0
  • 2
  • b
  • 1
  • A circle queue will not contain any wasted space
  • q.enqueue("f"); q.enqueue("j"); Current attributes:  Front = 0 Back = 5 Count = 6
  • Adds the j value here where the initial front was
  • 4
  • e
  • 5
  • 3
  • f
  • d
  • j
  • c
  • b
  • 0
  • 2
  • 1
  • isEmpty operation checks if the queue is empty
  • q.isEmpty(); returns a false in this case
  • 4
  • e
  • 3
  • 5
  • d
  • f
  • j
  • c
  • 0
  • b
  • 2
  • 1
  • Should the queue be empty however, it will return a true
  • q.dequeue(); q.dequeue(); q.dequeue(); q.dequeue(); q.dequeue(); q.dequeue(); q.isEmpty(); returns a true in this case
  • 4
  • 3
  • 5
  • 0
  • 2
  • 1
  • For the last function, we will use the queue prior to the isEmpty function. getFront returns the value that is in the front of the queue
  • q.getFront() This will return the value "b" as it is at the front of the queue
  • 4
  • 5
  • d
  • 3
  • d
  • c
  • 0
  • b
  • 2
  • 1
More Storyboards By infusion1231
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!