SEARCH
You are in browse mode. You must login to use MEMORY

   Log in to start

level: Stacks

Questions and Answers List

level questions: Stacks

QuestionAnswer
Define a stackAn abstract data type that holds an ordered, linear sequence of items where items are added and removed from the front
What are the two main operations of a stack?Push Pop
What does the push() operation do for a stack?an item is added to the top of the stack​
What does the pop() operation do for a stack?the top item is removed from the stack​​ ​
For a stack what is a pointer?A variable that marks the top of the stack
Give some computational functions of stacksCompilers can use a stack to check the syntax of programs For Reverse Polish Notation​ Use of a stack for function calls​
Describe what reverse polish notation isWriten notation where the operator comes after the values it operates on
Whats another name for Reverse Polish Notation?postfix
State the advantages of postfix notationNo need for brackets​ No need to define operator precedence (BIDMAS)​ Expression can be evaluated serially – no need to backtrack ​ So, faster for computer to evaluate
How is a stack used for nested function calls?Data is placed on a “stack frame” which ensures that the data retrieved is the most recently stored, ensuring that the function calls in the correct order