Computer Science, asked by tanmayapradhani2003, 5 months ago

write a python program to implement queue using a list data structure.​

Answers

Answered by AbhiThakur07
1

Explanation:

Python Program to Implement Queue Data Structure using Linked...

Create a class Node with instance variables data and next.

Create a class Queue with instance variables head and last.

The variable head points to the first element in the linked list while last points to the last element.

Define methods enqueue and dequeue inside the class Queue.

Answered by hassanshabnam031
0

Explanation:

To push an item in the queue, use the list function append list.append(item)

To pop an item from the queue, use the list function pop list.pop(0)

To get the top most item in the queue, get the last index of the list using: list

Similar questions