-
Notifications
You must be signed in to change notification settings - Fork 41
Earth/Taylor #22
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?
Earth/Taylor #22
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.
Nice work Taylor, you hit the learning goals here. Well done.
| # Time Complexity: O(nlogn) | ||
| # 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.
Since you have to go through all the chars and you're not splitting at each stage, this is O(n) for time complexity.
| if chars.include?(char) | ||
| stack.push(char) | ||
| else |
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.
Could you do this with a hash where the keys are the open brace and he values are the matching close brace? That might help you dry up those if-else statements.
| # 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.
👍 Interesting use of eval
| (@end + 1) % @size == @start | ||
| end | ||
|
|
||
| def enqueue(element) |
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.
👍
| end | ||
| end | ||
|
|
||
| def dequeue |
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,65 @@ | |||
| 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.
👍 Well done!
| @@ -1,22 +1,24 @@ | |||
| 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