lc3 - Are these output streams possible? -
i working on practice exam question
a the problem stack machine has input stream of abcd. possible output stream of cdba? cdab? show sequence of operations create these streams or if not possible explain why not possible.
i said both output streams possible.
for cdba, here sequence of operations create such stream
- push a
- push b
- push c
- pop c/store
- push d
for cdab
- push
- pop a/store
- push b
- push
- push c
- pop c / store
- push d
- push c
i assumed stack machine works stack -push pop. agree 2 sequences of operations? there property of "stack machine" makes these streams impossible create/produce?
yup, looks except need push c again @ end of cdba.
Comments
Post a Comment