Sonal Meenu Singh has Published 52 Articles

Turn a Queue into Priority Queue

Sonal Meenu Singh

Sonal Meenu Singh

Updated on 22-Feb-2023 15:59:12

1K+ Views

Introduction A queue is a linear data structure that follows the FIFO principle for inserting and removing elements and has no close ending. It is functional on both ends. In this tutorial, we will learn how to turn a queue into a priority Queue and understand the meaning of queue ... Read More

Time and Space Complexity Analysis of Queue operations

Sonal Meenu Singh

Sonal Meenu Singh

Updated on 22-Feb-2023 15:51:25

2K+ Views

Introduction Queue is a linear data structure that uses the FIFO approach for inserting and removing its elements. It can be implemented by using arrays and linked lists. In this tutorial, we will analyze the time and space complexity of array based queue for its different operation. Queue Implementation Using ... Read More

Should we declare it as Queue or Priority Queue while using Priority Queue in Java?

Sonal Meenu Singh

Sonal Meenu Singh

Updated on 22-Feb-2023 15:37:35

161 Views

Introduction The queue is a linear data structure that follows the FIFO approach to insert and extract its data. A priority Queue is a structured Queue, where all data have some priorities for their processing. In Java, a queue or priority queue is an interface. In this tutorial, we will ... Read More

Reverse a Stack using Queue

Sonal Meenu Singh

Sonal Meenu Singh

Updated on 22-Feb-2023 12:33:50

1K+ Views

Introduction Both Queue and Stack are linear data structures and are used to store data. Stack uses the LIFO principle to insert and delete its elements. A Queue uses the FIFO principle. In this tutorial, we will learn how to reverse a stack using Queue. Reversing means the last element ... Read More

How to Manage Full Circular Queue Event in C++?

Sonal Meenu Singh

Sonal Meenu Singh

Updated on 22-Feb-2023 12:28:34

199 Views

Introduction Circular Queue is an improvement over a linear queue and it was introduced to address the memory wastage problem in the linear queue. A circular queue uses the FIFO principle for the insertion and removal of the elements from it. In this tutorial, we will discuss the operations of ... Read More

How to implement size-limited Queue that holds last N elements in Java?

Sonal Meenu Singh

Sonal Meenu Singh

Updated on 22-Feb-2023 11:58:17

821 Views

Introduction A queue is an interface in Java. It is used to insert elements at one end and remove them from another end. It uses the FIFO principle for its processing. The queue extends the Collection framework and is defined in the Java.util interface. In this tutorial, we will ... Read More

Extracting last element of a Priority Queue without traversing

Sonal Meenu Singh

Sonal Meenu Singh

Updated on 22-Feb-2023 11:55:01

1K+ Views

Introduction The Priority Queue in C++ is not similar to the normal Queue in the data structure, it has one difference: all its elements have priorities. We can extract its elements by traversing in the Queue. But, here in this tutorial, we are trying a method for extracting the ... Read More

Difference Between Priority Queue and Queue Implementation in Java?

Sonal Meenu Singh

Sonal Meenu Singh

Updated on 22-Feb-2023 11:42:58

2K+ Views

The queue is a linear data structure that inserts elements from the back and removes elements from the starting end of the queue. A priority queue is an extended version of the normal queue with priorities for each element. In this tutorial, we learn about the queue and priority queue ... Read More

Difference Between add() & offer() methods in Queue in Java?

Sonal Meenu Singh

Sonal Meenu Singh

Updated on 22-Feb-2023 11:33:05

2K+ Views

Queue in Java is a linear data structure with various functions. A Queue has two endpoints and it follows the First-In-First-Out (FIFO)principle to insert and remove its elements. In this tutorial, we will look at two important functions of the queue in Java and they are add() and offer(). What ... Read More

Can we use Simple Queue instead of Priority queue to implement Dijkstra’s Algorithm?

Sonal Meenu Singh

Sonal Meenu Singh

Updated on 22-Feb-2023 11:25:00

2K+ Views

Introduction Dijkstra’s Algorithm is used to find the shortest possible distance between two objects. To implement this algorithm we mostly use Priority Queue. In this tutorial, we will find the answer to whether can we use a simple queue to implement Dijkstra’s algorithm instead of a Priority Queue. What is ... Read More

Advertisements