1 / 10

Queue ADT

Queue ADT. By Pantharee S. Queue Model. Like Stack , queues are list. Insertion is done at the end, whereas deletion is performed at the other end. (FIFO) Enqueue - inserts an element at the end of the list (rear)

yeva
Download Presentation

Queue ADT

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. Queue ADT By Pantharee S.

  2. Queue Model Like Stack , queues are list. Insertion is done at the end, whereas deletion is performed at the other end. (FIFO) Enqueue- inserts an element at the end of the list (rear) Dequeue- deleted (and returns) the element at the start of the list (front)

  3. Queue Model Queue Q Dequeue(Q) Enqueue(x,Q)

  4. Array Implement of Queueswith Circular Array Initial State After Enqueue(1) After Enqueue(3)

  5. Array Implement of Queueswith Circular Array After Dequeue,Which return 2 After Dequeue,Which return 4 After Dequeue,Which return 1

  6. Array Implement of Queueswith Circular Array After Dequeue,Which return 3 and Makes the Queue Empty

  7. จงบอกผลของการทำงานจากบนลงล่างจงบอกผลของการทำงานจากบนลงล่าง ..... Enqueue(“A”) A. void ..... Enqueue(“B”)B. “A” ..... Enqueue(“C”)C. “B” ..... Dequeue()D. “C” ..... Dequeue() E. “X” ..... Enqueue(“X”) ..... Dequeue()

  8. ตำแหน่งของตัวที่อยู่ท้าย Queue คือข้อใด A) front + size B) front + size – 1 C) front + size + 1 D) (front + size)%elementData.lenght E) (front + size – 1)%elementData.length F) (front + size + 1)%elementData.lenght

  9. Dequeue() ต้องทำสิ่งใดต่อไปนี้ A) size - -; B) elementData[front] = null; C) (++front)%elementData.length;

  10. Peek ต้องคืนข้อมูลตัวใด A) elementData[front] B) elementData[front + 1] C) elementData[front + size – 1] D) elementData[size – 1]

More Related