Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1e81aaf

Browse files
Update queue-linked-list-impl.py
1 parent 52ef437 commit 1e81aaf

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

‎queue/queue-linked-list-impl.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ def dequeue(self):
2929
self._count -= 1
3030
return ret_value.key
3131

32+
def peek(self):
33+
if self.is_empty():
34+
raise Exception("Queue is empty")
35+
return self._head.key
36+
3237
def size(self) -> int:
3338
return self._count
3439

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /