1 / 4

Ics202 Data Structures

Ics202 Data Structures. Deques. enqueueTail(5). enqueueHead(3). 1. 4. 1. 3. 1. 4. 1. 3. 1. 4. 1. 5. dequeueHead( ). dequeueHead( ). dequeueTail( ). 4. 1. 1. 4. 1. 1. 4. 1. 5.

truda
Download Presentation

Ics202 Data Structures

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Ics202Data Structures

  2. Deques enqueueTail(5) enqueueHead(3) 1 4 1 3 1 4 1 3 1 4 1 5 dequeueHead( ) dequeueHead( ) dequeueTail( ) 4 1 1 4 1 1 4 1 5

  3. Example 1:DequeAsArrayStep1: Create a project named DequeAsArrayTest.Step2: Copy and paste the ADTs folder in DequeAsArrayTest folder.Step3: At the beginning of your lab4 Java file import the package ADTs (all the classes).importADTs.DequeAsArray;importADTs.Visitor;importADTs.IntegerPrintingVisitor;Step4: Define a class (DequeAsArrayTest) in which:You create the main() method1. Instantiate the DequeAsArrayclass with object named queue1. 2. Fill queue1with the integers 5, 7, 8, and 3 (use the method enqueue(Object object)).3. Display the elements of queue1: use the showcontent().4. insert 6 as A head (use the method enqueueHead(Object object)).5. insert 9 as A Tail (use the method enqueueTail(Object object)).6. Display the elements of queue1: use the showcontent().7. remove head (use the method dequeueHead()).8. remove Tail (use the method dequeueTail()).9. Display the elements of queue1: use the accept() method of the interface Visitor.System.out.println("Visiting Stack Elements Using Visitor"); Visitor v = new IntegerPrintingVisitor();

  4. Example 2 : Using steps in Example 1 to test DequeAsLinkedList.Your file in ADTS to Be checked is (DequeAsLinkedList).

More Related