Deque - / 91.404 UMass Lowell 91.404 Analysis of...

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

View Full Document Right Arrow Icon
// 91.404 UMass Lowell 91.404 Analysis of Algorithms, Prof. KarenDaniels (Fall 2000) // Java implementation of Deque operations using array of Objects public class DequeTest {   public static void main(String[] args) {       int n = 8;       int i;       Deque Q = new Deque(n);       for (i=0;i<n-3;i++)  {         Q.EnqueueBack(new Integer(i));         Q.Print();        }       for (i=n-3;i<=n;i++) {         Q.EnqueueFront(new Integer(i));         Q.Print();        }       boolean front = true;       Object x = null;       for (i=0; i<=n; i++)  {         if (front) x = Q.DequeueFront();         else x = Q.DequeueBack();         Q.Print();         front = !front;        }      } }  class Deque {    int n = 10;  // default value    int head, tail;    Object D[];    Deque() {
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/13/2012 for the course CS 91.404 taught by Professor Dr.karendaniels during the Fall '09 term at UMass Lowell.

Page1 / 2

Deque - / 91.404 UMass Lowell 91.404 Analysis of...

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

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