FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python/datastruct/queue.py at master · Dreamgoing/python · GitHub
Dreamgoing
/
python
Public
forked from
flypythoncom/python
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
python
/
datastruct
/
queue.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
43 lines (33 loc) · 869 Bytes
Breadcrumbs
python
/
datastruct
/
queue.py
Copy path
File metadata and controls
43 lines (33 loc) · 869 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
class
Queue
:
def
__init__
(
self
,
size
=
20
):
self
.
queue
=
[]
self
.
size
=
size
self
.
end
=
-
1
def
setSize
(
self
,
size
):
self
.
size
=
size
def
In
(
self
,
element
):
if
self
.
end
<
self
.
size
-
1
:
self
.
queue
.
append
(
element
)
self
.
end
=
self
.
end
+
1
else
:
raise
"QueueFull"
def
Out
(
self
):
if
self
.
end
!=
-
1
:
element
=
self
.
queue
[
0
]
self
.
queue
=
self
.
queue
[
1
:]
self
.
end
=
self
.
end
-
1
return
element
else
:
raise
"QueueEmpty"
def
End
(
self
):
return
self
.
end
def
empty
(
self
):
self
.
queue
=
[]
self
.
end
=
-
1
if
__name__
==
"__main__"
:
queue
=
Queue
()
for
i
in
range
(
10
):
queue
.
In
(
i
)
print
queue
.
End
()
for
i
in
range
(
10
):
print
queue
.
Out
()
Back
|
FazBrowse Home
|
New Git URL