Contents
Chapter 7 · Data Structure and AlgorithmPractice

LEARN WITH HARU

Video Lesson တွေက Haru အတန်းသားတွေအတွက်ပါ

Haru ရဲ့ ITPEC FE Full Course မှာ ယခု သင်ခန်းစာတွေကို တစ်ခုချင်း တစ်ကြောင်းချင်း အသေးစိတ်ရှင််ရှင်းပြထားပါတယ်

အခြေခံ မရှိတဲ့ ကျောင်းသားများစွာဟာလည်း ဒီ Course နဲ့ ပဲ အောင်မြင်ကုန်ကြပါပြီ

အတန်းမအပ်သေးပဲ Haru ဆီမှာ အစမ်းသင်ကြည့်ချင်ပါသလား?

သင်တန်းသားတွေရဲ့ စကားသံများ

သင်တန်းသားတွေရဲ့ စကားသံများ

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 order1
Progress and bookmarks

p. 408 · PDF 418

1-3-2 Queue

Queue is a FIFO (First-In First-Out) data structure where data that is recorded first is read out first. You can simply think of data structure as a tube where entry and exit of data are different. A queue is also called a waiting line from the image of waiting in a line. Storing data in a queue is called enqueue (enq), and extracting data from a queue is called dequeue (deq). · 1 question

p. 409 · PDF 419

Figure 7-6  Image of queue; original source comparison.
Enlarge original visual
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:

Original Queue layout, PDF 419; original source comparison.
Enlarge original visual
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.

Figure 7-7  Image of circular use of array; original source comparison.
Enlarge original visual
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