RecursiveListWithIteratorsViaLinear1Ind - PowerPoint PPT Presentation

1 / 8
About This Presentation
Title:

RecursiveListWithIteratorsViaLinear1Ind

Description:

Pops from the top of the stack and returns the value. Problems. frontToRear ... Issue of traversing the recursive list in reverse order (separate from stack in remove ... – PowerPoint PPT presentation

Number of Views:12
Avg rating:3.0/5.0
Slides: 9
Provided by: csU60
Category:

less

Transcript and Presenter's Notes

Title: RecursiveListWithIteratorsViaLinear1Ind


1
RecursiveListWithIteratorsViaLinear1Ind
  • Michael OConnor
  • Eric Tallman
  • Matthew Yasiejko

2
Front to Rear
3
FrontToRear hasNext() and next()
  • hasNext()
  • Makes sure structure hasnt been modified.
  • Returns true if structure !isEmpty(), false
    otherwise.
  • next()
  • Sets boolean to allow remove.
  • Returns the value of the current object and moves
    one position towards the rear of the list.

4
Rear to Front
5
RearToFront Constructor
  • While the recursive list isnt empty, push the
    current object into a stack.
  • Move one position down the list using the tailOf
    call and setting the new list equal to the tail.

6
RearToFront hasNext() and next()
  • hasNext()
  • Makes sure structure hasnt been modified.
  • Checks to see if the stack is empty.
  • next()
  • Makes sure structure hasnt been modified.
  • Pops from the top of the stack and returns the
    value.

7
Problems
  • frontToRear
  • Removing one after the desired position.
  • rearToFront
  • Issue of traversing the recursive list in reverse
    order (separate from stack in remove()).
  • Additional issue of off by one removal.

8
Iterator Output
Write a Comment
User Comments (0)
About PowerShow.com