Data Structures and Algorithms in Java Chapter 4- Review Questions with Verified Answers Latest Update 2024 Already Passed
0 view 0 purchase
Course
Data Structures and Algorithms in Java Chapter 4
Institution
Data Structures And Algorithms In Java Chapter 4
Data Structures and Algorithms in Java Chapter 4- Review Questions with Verified Answers Latest Update 2024 Already Passed
Why are stacks, queues and priority queues more abstract than arrays? - Answers ...
What are stacks allowed access to? - Answers ...
Use the postal analogy to describe stac...
Data Structures and Algorithms in Java Chapter 4- Review Questions with Verified Answers Latest
Update 2024 Already Passed
Why are stacks, queues and priority queues more abstract than arrays? - Answers ...
What are stacks allowed access to? - Answers ...
Use the postal analogy to describe stacks. - Answers ...
Explain stacks using the work day analogy. - Answers ...
What is the "push"? - Answers Placing a data item on top of the stack.
What is "popping"? - Answers Removing a data item from the top of the stack.
Explain LIFO - Answers Last-In-First-Out. A stack is a LIFO storage mechanism because the last item
inserted is the first one to be removed.
What is "peek"? - Answers It allows the user to read the value at the top of the stack with out removing
it.
Explain how you would create an algorithm that matches delimiters on the stack. Include errors in your
explanation. - Answers 1. Read the characters from a string one at a time.
2. Find and place the opening delimiters on the stack one at a time
3. When the program reads a closing delimiter from the input, pop the corresponding opening delimiter
from the top of the stack
4. If the delimiters are not of the same type an error will occur, telling us that the string is missing either
an opening or closing delimiter. If there is no opening delimiter on the stack an error will occur.
What happens to non delimiter characters? - Answers They are not inserted onto the stack; they are
ignored.
Whatever you can do to manipulate the data storage structure becomes our: - Answers Methods.
What is the difference between a stack and a queue? - Answers In a queue the first item inserted is the
first to be removed (FIFO). In a stack the last item inserted is the first to be removed (LIFO)
Where does the term queue come from? - Answers It is a British reference to waiting in line. Fist in, first
out.
Unlike a stack, the items in a queue don't always: - Answers extend all the way down to index 0.
How is "peek" different in a queue? - Answers It "peeks" at the value of the item at the front of the
queue without removing it as opposed to the last value in a stack.
The benefits of buying summaries with Stuvia:
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
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
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 TutorJosh. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $7.99. You're not tied to anything after your purchase.