Skip to content

Conversation

@sarashahbaig
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 type
Describe a Stack Last in First out (LIFO)
What are the 5 methods in Stack and what does each do? Initialize: creates a linked list, Push: add an element to the last position, Pop: Removes the first element, Empty: returns true if the linked list is empty, to_s: returns the linked list into string format
Describe a Queue First in First out (FIFO)
What are the 5 methods in Queue and what does each do? Initialize: Creates an array, Enqueue: Adds an element, Dequeue: removes an element, Front: returns the element at the front, Empty?: check if queue is empty, to_s: return queue as a string.
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.

Well you didn't create the Queue using a circular buffer... using a LinkedList wasn't the assignment. So... there's that. It all works, and Stack is fine, but it's a good idea to read the assignment.

@@ -1,28 +1,61 @@
# Wave 2
# require_relative './stack.rb'
require "./linked_list"

Choose a reason for hiding this comment

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

This should be a require_relative, although you don't need a linked list in this class for the assignment.

def initialize
# @store = ...
raise NotImplementedError, "Not yet implemented"
@store = LinkedList.new

Choose a reason for hiding this comment

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

⚠️ You were asked to use a circular buffer instead of a LinkedList for this class.

These work, but using a LinkedList wasn't the assignment.

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