100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
CSC 231 UPDATED Questions and CORRECT Answers $9.99   Add to cart

Exam (elaborations)

CSC 231 UPDATED Questions and CORRECT Answers

 0 view  0 purchase
  • Course
  • CSC 231
  • Institution
  • CSC 231

CSC 231 UPDATED Questions and CORRECT Answers an ordered collection of items where the addition of new items and the removal of existing items always takes place at the same end - CORRECT ANSWER- stack is a stack LIFO or FIFO? - CORRECT ANSWER- LIFO what are the two main operations for stack...

[Show more]

Preview 2 out of 5  pages

  • November 13, 2024
  • 5
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • CSC 231
  • CSC 231
avatar-seller
MGRADES
CSC 231 UPDATED Questions and
CORRECT Answers
an ordered collection of items where the addition of new items and the removal of existing
items always takes place at the same end - CORRECT ANSWER✔✔- stack



is a stack LIFO or FIFO? - CORRECT ANSWER✔✔- LIFO



what are the two main operations for stacks? - CORRECT ANSWER✔✔- push() and pop()



Adds a value to the end of a stack. - CORRECT ANSWER✔✔- push()



returns and removes last value in a stack. - CORRECT ANSWER✔✔- pop()



what is the complexity of push() and pop()? - CORRECT ANSWER✔✔- O(1)



returns the last value in a stack(). - CORRECT ANSWER✔✔- peek()



what does is_empty do in a stack? - CORRECT ANSWER✔✔- returns true if the stack is
empty and false if it is not.


__init__ method for a stack. - CORRECT ANSWER✔✔- def __init__(self):
self.items = [ ]


is_empty method for a stack. - CORRECT ANSWER✔✔- def is_empty(self):
return self.items == [ ]


push method for a stack - CORRECT ANSWER✔✔- def push(item):
self.items.append(item)

, pop method for a stack - CORRECT ANSWER✔✔- def pop():
return self.items.pop()


peek method for a stack. - CORRECT ANSWER✔✔- def peek(self):
return self.items[len(self.items)-1]


What is an enqueue? - CORRECT ANSWER✔✔- adds a value to the beginning of the queue


ordered collection of items where the addition of new items happens at one end, called the
"rear," and the removal of existing items occurs at the other end, commonly called the
"front." - CORRECT ANSWER✔✔- queue



what are the two main operations of a queue? - CORRECT ANSWER✔✔- enqueue and
dequeue


Is a queue LIFO or FIFO? - CORRECT ANSWER✔✔- FIFO



What is a dequeue? - CORRECT ANSWER✔✔- removes a value from the end of the queue?



What is the first value of a queue called? - CORRECT ANSWER✔✔- Rear



What is the last value of a queue called? - CORRECT ANSWER✔✔- Front



Enqueue method for a queue. - CORRECT ANSWER✔✔- def enqueue(self, item):
self.items.insert(0,item)


Dequeue method for a queue. - CORRECT ANSWER✔✔- def dequeue(self):
return self.items.pop()

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller MGRADES. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $9.99. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

78140 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$9.99
  • (0)
  Add to cart