Skip to content

Sockets - Grace#32

Open
gracemshea wants to merge 1 commit intoAda-C11:masterfrom
gracemshea:master
Open

Sockets - Grace#32
gracemshea wants to merge 1 commit intoAda-C11:masterfrom
gracemshea:master

Conversation

@gracemshea
Copy link

@gracemshea gracemshea commented Oct 2, 2019

Stacks and Queues

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

Comprehension Questions

Question Answer
What is an ADT? ADTs (Abstract Data Structures) are objects that are described by their behaviors rather than by their implementation.
Describe a Stack Last in/First Out data structure
What are the 5 methods in Stack and what does each do? The 5 methods of a Stack are push (add element), pop (remove last element), empty? (return true if empty), to_s (list string of contents in Stack), initialize(creates new empty stack)
Describe a Queue First in/First Out data structure
What are the 5 methods in Queue and what does each do? The 5 methods of a queue are enqueue (add to beginning), dequeue (remove from beginning), front (give value of first element), size (give size of queue), empty?(return true if empty)
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.

Nice work Grace! You hit the learning goals here. Well done.

@@ -1,9 +1,38 @@
require_relative './stack.rb'

def balanced(string)

Choose a reason for hiding this comment

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

👍

Comment on lines +37 to +45
if (@head == @tail && !empty?)
return @capacity
elsif @head == @tail
return 0
elsif @tail > @head
return @tail - @head
elsif @tail < @head
return @capacity - (@head - @tail)
end

Choose a reason for hiding this comment

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

Well done!

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