Highlighted text? Practice this concept. Highlighted passages and figures open related questions.
Practice related questions (1)Progress & bookmarks
Current section
1-3-2 Queue
p. 408
Practice this section 1 linked exam question with default filters
Progress
Not marked complete
Related questions in this lesson 1
Queue first-in first-out order1p. 408 · PDF 418
1-3-2 Queue
p. 409 · PDF 419

Original source text
Figure 7-6 Image of queue
Source visual description
The original queue drawing shows enqueue and dequeue operations on the stored data.
For implementing a queue, an HP (Head Pointer) that points at the first element and a TP (Tail Pointer) that points at the last element are used. When data is stored, it is stored at the position that is obtained by updating the value (e.g., generally +1) of pointer TP. In contrast, when data is extracted, the value of pointer HP is updated (e.g., generally +1) after data is extracted from the position of pointer HP. The process (i.e., enq) of storing data in a queue is shown as follows:

Source visual description
Original Queue source layout. Source labels: .
When a queue is represented with an array, both pointers (HP and TP) keep increasing by one at a time. Therefore, an infinite number of array elements is required. So, in the actual process, when the value of a pointer becomes larger than the number of array elements, the concept of returning this value to 1 is used. With this concept, array elements are used in circulation, and it becomes possible to implement a queue with an array of the finite number of elements.

Original source text
Figure 7-7 Image of circular use of array
Source visual description
The original array row marks TP and HP positions and provides a shaded-data key.
Section progress
Original chapter exercises
Original chapter exercises →New FE Textbook Vol.1 · IT Fundamentals · First Edition, April 2015