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

Queues - Hyunji Kim - Stacks and Queues #27

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

Conversation

ricecakemonster
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? Abstract Data Types (the rules we must follow when interactinb with data.)
Describe a Stack A collection of items. The last one goes in will come out first.(LIFO)
What are the 5 methods in Stack and what does each do? push(adding a new stack), pop(removing top stack), empty?(returns true or false. checking to see if it's empty or not), top(showing the top element), size(returns the number of elements in it)
Describe a Queue A collection of items. The first one goes in will come out first.(FIFO)
What are the 5 methods in Queue and what does each do? enqueue(adding a new queue), dequeue(removing the front queue), empty?(returns true or false. checking to see if it's empty or not), front(showing the first element), size(returns the number of elements in it)
What is the difference between implementing something and using something? Implementing is writing a program(coding). Using is using the written program to do something.

OPTIONAL JobSimulation

Question Answer
Did you include a sample run of your code as a comment? no. didn't know that we had to do that...

jobs_available.times do
@workers.push(@waiting.front)
@waiting.dequeue
end

Choose a reason for hiding this comment

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

Watch your tabbing here inside the do/end.

Choose a reason for hiding this comment

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

Since dequeue returns the element that's removed, you could simplify above as follows:

jobs_available.times do
  @workers.push( @waiting.dequeue )
end

@roll.times do
@workers.push(@waiting.front)
@waiting.dequeue
end

Choose a reason for hiding this comment

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

Same here as above.

@sudocrystal
Copy link

Stacks and Queues

What We're Looking For

Feature Feedback
Implementation of Stack looks complete yes
Implementation of Queue looks complete yes

OPTIONAL JobSimulation

Extension Feedback
Does the code solve the problem to specification? yes
Is the code easy to follow? yes
Does the output look good? yes
Were provided variables and methods used appropriately and not altered in name or definition? yes
Were any new variables and/or methods made private to the class?

Looks good! Nice with testing too.

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