Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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 pts

Explanation / 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.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote