-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathQUETEST.PY
46 lines (39 loc) · 837 Bytes
/
QUETEST.PY
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
def Insert(N):
global Front,Rear
if(len(Queue)==1):
Front=0
Rear=0
else:
Rear=len(Queue)-1
Queue.append(N)
def disp():
if(len(Queue)==0):
print("Underflow")
else:
print("The valuse is now")
for i in range(0,len(Queue)):
print(Queue[i],end=' ')
def dequeue():
global Front,Rear
if(len(Queue)==0):
print("Underflow")
else:
if(len(Queue)==0):
Front=None
Rear=None
else:
Rear=Rear-1
print("\n The value is deleted",Queue.pop(0))
def peek():
print("\nThe value at the front inspected is ",Queue[0])
Front=None
Rear=None
Queue=[]
Insert(5)
Insert(7)
Insert(9)
disp()
peek()
dequeue()
dequeue()
disp()