Skip to content

Conversation

VeronicaO27
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?
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

@kyra-patton kyra-patton left a comment

Choose a reason for hiding this comment

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

Hi Veronica, I'm grading this as a red as your Stack implementation doesn't use a LinkedList which we do want you to practice using. We'd also like for you to make an attempt at the comprehension questions.

I'd be happy to regrade when you resubmit.

🔴

Raises a QueueFullException if all elements
In the store are occupied
returns None
"""

Choose a reason for hiding this comment

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




def dequeue(self):

Choose a reason for hiding this comment

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

return self.store[self.front]


def front(self):

Choose a reason for hiding this comment

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

return self.store[self.front]


def size(self):

Choose a reason for hiding this comment

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

pass
return self.size

def empty(self):

Choose a reason for hiding this comment

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

else:
return False

def __str__(self):

Choose a reason for hiding this comment

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


def __init__(self):
self.store = LinkedList()
# self.store = LinkedList()

Choose a reason for hiding this comment

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

⚠️ While your implementation does work with a list, the README does specifically ask you to use the LinkedList class in your implementation. The reason is that we want you to get more practice using (in addition to implementing) linked lists as they are commonly used in interviews.

Copy link

@kyra-patton kyra-patton 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! Thanks for updating. For the difference between implementing v using. Implementing means to write or implement a function/piece of code yourself. Using means to just call or reuse code that someone else wrote/implemented. Think about when you use functions from a library or imported module or call an API, vs you implementing your own set of functions or your own API.

Let me know what questions you have!

🟢

self.store = LinkedList()
# self.store = list()

def push(self, element):

Choose a reason for hiding this comment

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




def pop(self):

Choose a reason for hiding this comment

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

"""
pass

if self.store.length() == 0:

Choose a reason for hiding this comment

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

And False otherwise
"""
pass
if self.store.length() == 0:

Choose a reason for hiding this comment

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

ending with the bottom of the Stack.
"""
pass
string_stack = self.store[::-1]

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