Skip to content

Liv - Space#20

Open
mulhoo wants to merge 3 commits intoAda-C13:masterfrom
mulhoo:master
Open

Liv - Space#20
mulhoo wants to merge 3 commits intoAda-C13:masterfrom
mulhoo:master

Conversation

@mulhoo
Copy link
Copy Markdown

@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
Copy Markdown

@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.

Comment thread lib/problems.rb
@@ -1,13 +1,25 @@
require_relative './stack.rb'
Copy link
Copy Markdown

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 thread lib/problems.rb
Comment on lines +6 to +10
pairs = {
')' => '(',
'}' => '{',
']' => '['
}
Copy link
Copy Markdown

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 thread lib/problems.rb
Comment on lines +3 to 5
# Time Complexity: on
# Space Complexity: on
def balanced(string)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

Comment thread lib/queue.rb
@front = @back = -1
end

def enqueue(element)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

Comment thread lib/queue.rb
@back = (@back+1) % @store.length
end

def dequeue
Copy link
Copy Markdown

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.

Comment thread lib/stack.rb
@@ -1,19 +1,23 @@
require_relative 'linked_list'
Copy link
Copy Markdown

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