Tutorial 6

Tutorial 6 - CS 134 Tutorial 6: More Stacks, Queues and...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 134 Tutorial 6: More Stacks, Queues and Midterm Information CS 134 Tutors Winter 2008 1 More on Stacks Problem . The method flipStackHalves , as its name suggests, modifies the given stack, so that the upper and lower halves of the stack reverse locations. Complete the method flipStackHalves , according to the pre and post conditions stated below. You may use the standard stack operations and assume that the size() method exists (as a pre-coded helper method). You may use several helper stacks in your implementation (use DataFactory.makeStack() as needed). DANGER: Note that the size() method is not a part of StackInterface (you should be able to code this method for yourself as a helper method). Hint: Draw a picture before you begin! //pre: this.size() is even //post: this is modified such that the first half of this becomes the last half, // and the last half becomes the first half public void flipStackHalves() { // your solution here } 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Queues 2.1 Queue ADT Operations: boolean isEmpty()
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/25/2010 for the course CS CS134 taught by Professor Cl during the Fall '07 term at Waterloo.

Page1 / 4

Tutorial 6 - CS 134 Tutorial 6: More Stacks, Queues and...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online