Загрузка...

Queue| Implement Queue with Java language | Data Structures for Beginners | Full Program | Part 2

In this session - we will discuss the Data Structures and Algorithms for Beginners
What is Queue and implement with java program.
What is Queue?​
Ans:-
- Queue is a linear data structure where the first element is inserted from one end called REAR and deleted from the other end called as FRONT.​
- Front points to the beginning of the queue and Rear points to the end of the queue.​
- Queue follows the FIFO (First - In - First Out) structure.​
- According to its FIFO structure, element inserted first - will also be removed first.​
- In a queue, one end is always used to insert data (enqueue) and the other is used to delete data (dequeue), because queue is open at both its ends.​
- The enqueue() and dequeue() are two important functions used in a queue.​
Q. Basic Opration in Queue?
Ans:-
enqueue() : This function is used for adding an element into queue.​

dequeue() : This function is used for the removing an element from queue.​

init() : This function is used for initializing the queue.​

Front : Front is used to get the front data item from a queue.​

Rear : Rear is used to get the last item from a queue.​

​Q. Types of the Queue​?
Ans:-
The standard queue data structure has the following variations:​

Simple queue​

Priority queue​

Circular queue​

Double-ended queue​

Simple Queue: The simple queue is a normal queue where insertion take place at the FRONT of the queue and deletion take place at the END of the queue.​

Priority Queue: In a prioqueue, the nodes will have some predefined proprity. Insertion in a priority queue is performed in the order of arrival of the nodes. The nodes have least priority will be removed form the priority queue.​

Double-ended queue: In a standard queue, a character is inserted at the back and deleted in the front. However, in a double-ended queue, characters can be inserted and deleted from both the front and back of the queue.​

Circular queues: A circular queue is an improvement over the standard queue structure. In a standard queue, when an element is deleted, the vacant space is not reutilized. However, in a circular queue, vacant spaces are reutilized.While inserting elements, when you reach the end of an array and you need to insert another element, you must insert that element at the beginning (given that the first element has been deleted and the space is vacant).​


Видео Queue| Implement Queue with Java language | Data Structures for Beginners | Full Program | Part 2 канала XAdmin
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять