0% found this document useful (0 votes)
8 views3 pages

Quiz 2

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)
8 views3 pages

Quiz 2

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/ 3

CS221- Data Structures & Algos, Fall 2024, Quiz # 2

Total Time: 50 Minutes Total Marks: 50

Name:______________________ Registration #: ______________________

Question: Write code for circular Queue using LinkList having Enqueue, Dequeue and DisplayQueue
functions. The Enqueue function should insert an element at the end of Queue, and the dequeue function
should delete the first element in the Queue, and update the positions of the remaining entries in the
Queue. The DisplayQueue function should display the value at each position. Complete the missing code
below:

#include <iostream>
using namespace std;
struct queue
{
int data;
queue *next;
};

void Enqueue(int newData)


{

Page 1 out of 3
}

int Dequeue()
{

}
Page 2 out of 3
void DisplayQueue()
{

}
int main()
{
DisplayQueue();
Enqueue(3); Enqueue(6); Enqueue(9); Enqueue(12); Enqueue(15); Enqueue(18);
DisplayQueue();
Dequeue(); Dequeue();
DisplayQueue();
Enqueue(30); DisplayQueue();

return 0;
}

Page 3 out of 3

You might also like