Download
queue adt n.
Skip this Video
Loading SlideShow in 5 Seconds..
Queue ADT PowerPoint Presentation

Queue ADT

129 Vues Download Presentation
Télécharger la présentation

Queue ADT

- - - - - - - - - - - - - - - - - - - - - - - - - - - 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]