Branches - Brianna#36
Open
brikemp wants to merge 5 commits into
Open
Conversation
CheezItMan
reviewed
Mar 10, 2020
CheezItMan
left a comment
There was a problem hiding this comment.
Nice work, you hit the main learning goals here. There are some issues with the Queue class. Take a look at my comments and let me know any questions you have.
| # Space Complexity: ? | ||
| # Time Complexity: O(n) - n is chars in string | ||
| # Space Complexity: O(1/2n) --> O(n) - n is chars in string | ||
| def balanced(string) |
Comment on lines
27
to
29
| # Time Complexity: ? | ||
| # Space Complexity: ? | ||
| def evaluate_postfix(postfix_expression) |
| def enqueue(element) | ||
| raise NotImplementedError, "Not yet implemented" | ||
| if((@front == 0 && @back == @store.length - 1) || (@front == @back + 1)) |
There was a problem hiding this comment.
It might be better to use `@front == (@back + 1) % @store.length
| end | ||
|
|
||
| def dequeue |
| raise ArgumentError | ||
| end | ||
|
|
||
| return @back - @front |
Comment on lines
+51
to
+55
| if @front == -1 && @back == -1 | ||
| return true | ||
| else | ||
| return false | ||
| end |
There was a problem hiding this comment.
Suggested change
| if @front == -1 && @back == -1 | |
| return true | |
| else | |
| return false | |
| end | |
| return @front == -1 && @back == -1 |
| def to_s | ||
| return @store.to_s | ||
| return @store[@front...@back].to_s |
There was a problem hiding this comment.
Again this only works if front < back.
Comment on lines
+63
to
+72
| # q = Queue.new | ||
| # q.enqueue(0) | ||
| # q.enqueue(1) | ||
| # q.enqueue(2) | ||
| # q.enqueue(3) | ||
| # p q | ||
| # p q.size | ||
| # p q.dequeue | ||
| # p q.size | ||
| # p q.front No newline at end of file |
There was a problem hiding this comment.
This should probably be removed before submission
Suggested change
| # q = Queue.new | |
| # q.enqueue(0) | |
| # q.enqueue(1) | |
| # q.enqueue(2) | |
| # q.enqueue(3) | |
| # p q | |
| # p q.size | |
| # p q.dequeue | |
| # p q.size | |
| # p q.front |
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