Answer to Question #45496 in Programming & Computer Science for Naf

Question #45496
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.
0
Expert's answer

Answer in progress...

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS