Skip to content
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

Leaves - Bri #47

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Leaves - Bri #47

wants to merge 3 commits into from

Conversation

brilatimer
Copy link

Stacks and Queues

Thanks for doing some brain yoga. You are now submitting this assignment!

Comprehension Questions

Question Answer
What is an ADT?
Describe a Stack
What are the 5 methods in Stack and what does each do?
Describe a Queue
What is the difference between implementing something and using something?
When is a circular buffer advantageous over a dynamic array or LinkedList?

Copy link

@CheezItMan CheezItMan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You got problem 1 and the stack, but you didn't use a circular buffer for the Queue. It works, but it wasn't the assignment... so there's that. Not bad, but try to do the work as assigned.

end

if char == '{'
stack.push '}'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Close brace?

Comment on lines +3 to 5
# Time Complexity: O(n)
# Space Complexity: O(n)
def balanced(string)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have the right idea here with one typo. See below.

Do consider using a hash, it could make the code more compact.

@@ -1,16 +1,17 @@
require 'linked_list.rb'

class Queue

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the Queue you were supposed to use a circular buffer. So this works, but it's not the assignment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants