Question 4 Assume you are working with the class LinkedStackofStrings. Complete
ID: 3782794 • Letter: Q
Question
Question 4 Assume you are working with the class LinkedStackofStrings. Complete the sentences below. Pushing an item on the stack takes Select time Popping an item from the stack takes [Select time. checking whether the stack is empty takes constant time Question 5 Below you find some statements regarding loitering. However, one of the statements is WRONG. Which one is it? O Loitering is an issue when removing an element from a stack that is implemented with an array Loitering is an issue when removing an element from a stack that is implemented with linked nodes. O Loitering is the idea that we keep references to an object that is no longer used Loitering prevents the garbage collector from reclaiming memory that is no longer used. 1 pts 1 ptsExplanation / Answer
4)
a) O(1), time.
b) O(1), time.
Explanation-All operations except get-size() can be performed in O(1) time. get-size() runs in at worst O(N)
5) B. These are objects that are still referenced by the application but are no longer in use. Stack implementaion uses referencing hence B is right answer.
6) A. for large amount of data stack implementation will be faster.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.