Skip to content

Conversation

@mulhoo
Copy link

@mulhoo mulhoo commented Sep 9, 2020

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 are the 5 methods in Queue and what does each do?
What is the difference between implementing something and using something?

OPTIONAL JobSimulation

Question Answer
Did you include a sample run of your code as a comment?

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.

Liv, Nice work, you hit the learning goals here. Well done. Take a look at my comments and let me know if you have questions, but this is quite well done.

@@ -1,13 +1,25 @@
require_relative './stack.rb'

Choose a reason for hiding this comment

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

Just a note on missing comprehension question answers.

Comment on lines +6 to +10
pairs = {
')' => '(',
'}' => '{',
']' => '['
}

Choose a reason for hiding this comment

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

Love the use of a hash here.

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

Choose a reason for hiding this comment

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

👍

@front = @back = -1
end

def enqueue(element)

Choose a reason for hiding this comment

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

👍

@back = (@back+1) % @store.length
end

def dequeue

Choose a reason for hiding this comment

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

You should also check to see if the Queue is empty and you try to dequeue.

@@ -1,19 +1,23 @@
require_relative 'linked_list'

Choose a reason for hiding this comment

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

👍

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