Front Operation in Queue Data Structure
This operation returns the element at the front end without removing it.
// Function to get front of queue
int front(Queue* queue)
{
if (isempty(queue))
return INT_MIN;
return queue->arr[queue->front];
}
// Function to get front of queue
int front(struct Queue* queue)
{
if (isempty(queue))
return INT_MIN;
return queue->arr[queue->front];
}
// This code is contributed by Susobhan Akhuli
// Function to get front of queue
int front(Queue queue)
{
if (isempty(queue))
return Integer.MIN_VALUE;
return queue.arr[queue.front];
}
// This code is contributed by aadityapburujwale
# Function to get front of queue
def que_front(self):
if self.isempty():
return "Queue is empty"
return self.Q[self.front]
# This code is contributed By Susobhan Akhuli
// Function to get front of queue
public int front()
{
if (isempty())
return INT_MIN;
return arr[front];
}
// This code is contributed By Susobhan Akhuli
<script>
// Function to get front of queue
front(){
// returns the Front element of
// the queue without removing it.
if(this.isEmpty())
return "No elements in Queue<br>";
return this.items[0];
}
// This code is contributed By Susobhan Akhuli
<script>
Introduction to Queue Data Structure
Queue Data Structure is a linear data structure that follows FIFO (First In First Out) Principle, so the first element inserted is the first to be popped out. In this article, we will cover all the basics of Queue, Operations on Queue, its implementation, advantages, disadvantages which will help you solve all the problems based on Queue.
Table of Content
- What is Queue Data Structure?
- Representation of Queue Data Structure:
- Types of Queue Data Structure
- Basic Operations in Queue Data Structure
- 1. Enqueue Operation in Queue Data Structure
- 2. Dequeue Operation in Queue Data Structure
- 3. Front Operation in Queue Data Structure
- 4. Rear Operation in Queue Data Structure
- 5. isEmpty Operation in Queue Data Structure
- 6. isFull Operation in Queue Structure
- Implementation of Queue Data Structure
- Complexity Analysis of Operations on Queue Data Structure
- Applications of Queue Data Structure
- Advantages of Queue Data Structure
- Disadvantages of Queue Data Structure
- FAQs (Frequently asked questions) on Queue Data Structure
Contact Us