Per the text, real or emulated stack machines are used to execute code instructi
ID: 3848450 • Letter: P
Question
Per the text, real or emulated stack machines are used to execute code instructions. The Java Virtual Machine uses the stack concept in order to execute bytecode. Suppose you needed to create your own stack machine. Indicate whether you would use an array-based stack machine or linked list-based stack machine. Provide a rationale for your response.
As explained in the e-Activity, the Standard C++ Foundation occasionally revises the C++ programming language. Some of the reasons could include the incorporation of new language features from research and / or to fix problematic areas in the current revision. Indicate whether you believe the Foundation should spend more time fixing current problems or incorporating new language features. Provide a rationale for your response.
Explanation / Answer
Implementing own Stack
Stack is a data structure in which data is stored on top of each other just like a stack of plates. It supports 3 standard operations viz. push, pop and peek. push inserts the data on top of the stack, pop retrieves and removes the data on top of stack which peek just retrieves the data without removing.
So what should be the characterstics of data structure to be used to build a stack?
So Which one to choose between array and linkedlist?
Well it depends. Both array and linked list satisfies the first condition i.e. constant time operations O(1). But the second point differs. Array use less memory than linked list (Because linked list has to store data + address of next node in each node). But array cannot change it's size. If you want to change size, you have to perform huge data shifting operations which would increase the time complexity. So this is what you can do :
Regarding your second question, I believe C++ should have new features. When compared to high level languages like python, ruby which increases productivity, C++ though fast is tedious to code. Also currently there are not any major problem in current revision of language. But answer to this question is debatable and this answer is totally opinion based.
Hope it helps!
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.