0% found this document useful (0 votes)
4 views4 pages

Ashish Gurjar FDS EXP07

The document outlines an experiment focused on implementing various operations on a Queue data structure using C programming. Key operations include enQueue, deQueue, Peek, isFull, isEmpty, and Display_Queue, with corresponding code provided. The experiment was conducted by Ashish Gurjar, with specified dates for the experiment and submission.

Uploaded by

ag5250715
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views4 pages

Ashish Gurjar FDS EXP07

The document outlines an experiment focused on implementing various operations on a Queue data structure using C programming. Key operations include enQueue, deQueue, Peek, isFull, isEmpty, and Display_Queue, with corresponding code provided. The experiment was conducted by Ashish Gurjar, with specified dates for the experiment and submission.

Uploaded by

ag5250715
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Experiment 07

AIM: Perform following opera ons on Queue Data Structure


using Array/LinkedList.
1. enQueue
2. deQueue
3. Peek
4. isFull
5. isEmpty
6. Display_Queue

Name: Ashish Gurjar


Enrollment number: 23100BTCSE14795
Date of experiment:30/09/24
Date of submission: 12/10/24

CODE:
#DevC++
#include <stdio.h>
#include <stdlib.h>
#define MAX 6
int queue[MAX];
int front = -1, rear = -1;
void enQueue(int value) {
if (rear == MAX - 1) {
prin ("Queue is Full\n");
} else {
if (front == -1) front = 0;
queue[++rear] = value;

}
}
void deQueue() {
if (front == -1 || front > rear) {
prin ("Queue is Empty\n");
} else {
prin ("%d dequeued from the queue\n", queue[front]);
front++;
}
}
int peek() {
if (front == -1 || front > rear) {
prin ("Queue is Empty\n");
return -1;
} else {
return queue[front];
}
}
int isFull() {
return rear == MAX - 1;
}
int isEmpty() {
return front == -1 || front > rear;
}
void displayQueue() {
if (isEmpty()) {
prin ("Queue is Empty\n");
} else {
prin ("Queue: ");
for (int i = front; i <= rear; i++) {
prin ("%d ", queue[i]);
}
prin ("\n");
}
}
int main() {
enQueue(15);
enQueue(25);
enQueue(35);
displayQueue();
deQueue();
displayQueue();
prin ("Peek: %d\n", peek());
return 0;
}
OUTPUT

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy