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

Sockets - Karla #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Sockets - Karla #29

wants to merge 1 commit into from

Conversation

kguadron
Copy link

@kguadron kguadron commented Sep 19, 2019

Stacks and Queues

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

Comprehension Questions

Question Answer
What is an ADT? An abstract data type is a data type that has a particular set of methods it can perform but it can be implemented in different ways
Describe a Stack A stack follows the LIFO accessing pattern
What are the 5 methods in Stack and what does each do? push adds something to the top of the stack, pop takes the top/most recent item off the stack, is_empty tells if the stack has items or not, peek returns the value of the top item in the stack but doesn't take it off the stack
Describe a Queue FIFO
What are the 5 methods in Queue and what does each do? enqueue: adds to the end of the q, dequeue: removes from the front of the q, is_empty: returns true if 0 items in the q, front: returns first item in q, size: returns # of items in q
What is the difference between implementing something and using something? When you implement something you are writing the basic functions that give that something any behavior, when you use something you are assuming it has the standard functionality and not necessarily writing out all that code yourself

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, with one minor bug, you hit all the learning goals here. Well done!

else
removed = @store[@front]
@store[@front] = nil
@front = @front + 1

Choose a reason for hiding this comment

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

This should be @front = (@front + 1) % QUEUE_SIZE

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