-
Notifications
You must be signed in to change notification settings - Fork 44
Space - Hala #24
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
base: master
Are you sure you want to change the base?
Space - Hala #24
Conversation
CheezItMan
left a comment
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.
You didn't implement the Queue with a circular buffer. Other than that major piece you hit all the learning goals.
| # Time Complexity: O(N) | ||
| # Space Complexity: O(N) | ||
| def balanced(string) |
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 char == ']' && element != '[' | ||
| return false | ||
| elsif char == ')' && element != '(' | ||
| return false | ||
| elsif char == '}' && element != '{' | ||
| return false | ||
| end |
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.
This could be dried up using a hash with keys being the open brace and the value being the corresponding close brace.
| # Time Complexity: O(N) | ||
| # Space Complexity: O(N) | ||
| def evaluate_postfix(postfix_expression) |
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,31 +1,36 @@ | |||
| require_relative "linked_list" | |||
|
|
|||
| class Queue | |||
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.
This works, but isn't implemented with a circular buffer. So it's not what's asked for.
| @@ -1,22 +1,28 @@ | |||
| require_relative "linked_list" | |||
|
|
|||
| 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.
👍
Stacks and Queues
Thanks for doing some brain yoga. You are now submitting this assignment!
Comprehension Questions
OPTIONAL JobSimulation