TEchMyEducation

easy tech learning...

Datastructure Queue and types of queue

No comments

data structure Queue

Today we will read about the data structure queue in this post, so let's start: -

Queue is a non-primitive and linear data structure, it works on the principle of first in first out (FIFO), ie the item that is added first will be removed first and the item that is added last. is added, it will be removed at the end.

We often use Queue in our real world, let's see an example of this: -

"Let's take the example of railways, a person who is first on the railway ticket reservation line and goes first with a ticket, a person who is engaged in the last will go out at the end."

data structure Queue and types of queue

Queue consists of two major operations: -

1. Enqueue

2. Dequeue

When we insert an item in Queue, that process is called Enqueue and when we remove an item from Queue, that process is called Dequeue.

Terms of Queue: - Queue has the following conditions: -

1: - If FRONT is <0, Queue is empty (empty).

2: - If REAR = size of Queue, then Queue is full.

3: - If there is FRONT <REAR, there is at least one item in Queue.

4: - If you want to know the total number of items in Queue, then :-( REAR-FRONT) +1.

Queue types: -

Queue types in a data structure are as follows: -

1: - Circular queue

2: - Dequeue.

1. Circular queue:

Circular queue is also called ring-buffer. The last node in the circular queue is connected to the first node. So that the circle is formed.In Circular Queue, the item is added from the rear end and the item is removed from the front end.

2. Dequeue:

The full name of the dequeue is double-ended queue. Dequeue is a data structure in which we can also add and remove items from both front and rear end.

There are two types of dequeue which are as follows: -

1: - Input-restricted Dequeue

2: - Output-restricted Dequeue.

1. - Input-restricted Dequeue

Items in this type of queue can be deleted from both ends but can only be inserted from one end.

2: - Output-restricted Dequeue

In this type of queue, items can be inserted from both sides but only one can be deleted from the end.


Request: -If you have any questions or any topics related to subjects related to a computer, then tell us, we will publish it here in Hindi within a day or two. And share this post of queue types with your friends.

No comments :

Post a Comment