Presentation is loading. Please wait.

Presentation is loading. Please wait.

Ics202 Data Structures. U n i v e r s i t y o f H a i l Queueus 314 enqueue(1)enqueue(5) 314131415 15 dequeue( ) 4151415.

Similar presentations


Presentation on theme: "Ics202 Data Structures. U n i v e r s i t y o f H a i l Queueus 314 enqueue(1)enqueue(5) 314131415 15 dequeue( ) 4151415."— Presentation transcript:

1 Ics202 Data Structures

2 U n i v e r s i t y o f H a i l Queueus 314 enqueue(1)enqueue(5) 314131415 15 dequeue( ) 4151415

3 import ADTs.QueueAsArray; import ADTs.Visitor; import ADTs.IntegerPrintingVisitor; public class QueueAsArrayTest { public static void main(String[] args) { // create an object of the class QueueAsArray called queue with size = 20. // create an object of the class QueueAsArray called queue2 with size = 20. // Using the enqueue() method, to insert (1,2,3) into the queue. System.out.println("Visiting Queue Elements Using Visitor"); Visitor v = new IntegerPrintingVisitor(); queue.accept(v);

4 // Using the dequeue() method, to delete (1,2) from the queue. queue.showContent(); // Using the enqueue() method, to insert (1,2,3) into the queue2. System.out.println(); // Using the showContent () method to show the elements of queue2. if (queue.isEQ(queue2)) System.out.println("queue equals queue2"); else if (queue.isLT(queue2)) System.out.println("queue less than queue2"); else if (queue.isGT(queue2)) System.out.println("queue greater than queue2"); } }

5 U n i v e r s i t y o f H a i l 314 enqueue(1)enqueue(5) 314131415 15 dequeue( ) 4151415 Using steps in Example 1 to test QueueAsLinkedList, Create your project with name (QueueAsLinkedListTest).


Download ppt "Ics202 Data Structures. U n i v e r s i t y o f H a i l Queueus 314 enqueue(1)enqueue(5) 314131415 15 dequeue( ) 4151415."

Similar presentations


Ads by Google