Roza-Cedar, re-submission including comprehension questions#38
Open
haset-19 wants to merge 1 commit intoAda-C16:masterfrom
Open
Roza-Cedar, re-submission including comprehension questions#38haset-19 wants to merge 1 commit intoAda-C16:masterfrom
haset-19 wants to merge 1 commit intoAda-C16:masterfrom
Conversation
kyra-patton
reviewed
Jun 14, 2022
| returns None | ||
| """ | ||
| pass | ||
| if self.size == self.buffer_size: |
| The Queue is empty. | ||
| """ | ||
| pass | ||
| if self.empty(): |
| is empty. Does not remove anything. | ||
| """ | ||
| pass | ||
| return self.store[self.front] |
| The Queue | ||
| """ | ||
| pass | ||
| return self.size |
| And False otherwise. | ||
| """ | ||
| pass | ||
| return self.front == self.rear |
There was a problem hiding this comment.
👀 This will check if the queue is empty, but it could also mean the queue
Comment on lines
+86
to
+88
| while (start_index % INITIAL_QUEUE_SIZE) < INITIAL_QUEUE_SIZE and len(queue_list) < self.size: | ||
| if self.store[start_index % INITIAL_QUEUE_SIZE] is not None: | ||
| queue_list.append(self.store[start_index % INITIAL_QUEUE_SIZE]) |
There was a problem hiding this comment.
I would recommend using self.buffer_size instead of the constants for style reasons. It will also allow us to expand our queue functionality in the future, say if we wanted to increase buffer_size instead of just raising an error.
Suggested change
| while (start_index % INITIAL_QUEUE_SIZE) < INITIAL_QUEUE_SIZE and len(queue_list) < self.size: | |
| if self.store[start_index % INITIAL_QUEUE_SIZE] is not None: | |
| queue_list.append(self.store[start_index % INITIAL_QUEUE_SIZE]) | |
| while (start_index % self.buffer_size) < self.buffer_size and len(queue_list) < self.size: | |
| if self.store[start_index % self.buffer_size] is not None: | |
| queue_list.append(self.store[start_index % self.buffer_size]) |
| """ | ||
| pass | ||
|
|
||
| self.store.add_first(element) |
| """ | ||
| pass | ||
|
|
||
| return self.store.remove_first() |
| And False otherwise | ||
| """ | ||
| pass | ||
| return self.store.empty() |
| pass | ||
| return self.store.empty() | ||
|
|
||
| def __str__(self): |
There was a problem hiding this comment.
✨ This works, but you might also consider taking advantage of LinkedList's str() method
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacks and Queues
Thanks for doing some brain yoga. You are now submitting this assignment!
Comprehension Questions
OPTIONAL JobSimulation