-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rock - Delia #34
base: master
Are you sure you want to change the base?
Rock - Delia #34
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work Delia, you hit the learning goals, well done. Nothing to critique here, excellent submission.
if self.size == self.buffer_size: | ||
raise QueueFullException("The queue is full") | ||
else: | ||
self.rear = (self.rear + 1) % self.buffer_size | ||
self.store[self.rear] = element | ||
self.size += 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
if self.size == 0: | ||
raise QueueEmptyException("The queue is empty") | ||
else: | ||
front_item = self.store[self.front] | ||
self.front = (self.front + 1) % self.buffer_size | ||
self.size = self.size - 1 | ||
return front_item |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
if self.size == 0: | ||
return None | ||
else: | ||
return self.store[self.front] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
q_list = [] | ||
for i in range(self.front, self.front + self.size): | ||
i = i % self.buffer_size | ||
q_list.append(self.store[i]) | ||
return str(q_list) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -1,7 +1,7 @@ | |||
from stacks_queues.linked_list import LinkedList | |||
|
|||
class StackEmptyException(Exception): | |||
pass | |||
pass | |||
|
|||
class Stack: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stack looks good!
Stacks and Queues
Thanks for doing some brain yoga. You are now submitting this assignment!
Comprehension Questions
OPTIONAL JobSimulation