1. A desk can be modelled as a simple data structure with the following ADT Desk:
• add(x) puts item x on top of the desk
• process() processes the top item on the desk and removes it (either sending it to someone else or
just throwing it away!)
• find(x) finds and retrieves the item x if it’s somewhere on the desk
• scan() looks at the top item on the desk, but doesn’t remove it
i). What data structure can you think of that is most like the ADT Desk? Give reasons.
ii). Write out in pseudocode in the space below how you would implement the find(x)
method in the ADT Desk above, using only stacks. Assume the standard methods for a stack have
already been defined.
iii). What is the running time of your method above? explain.
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment