Stacks are discussed on a high level in terms of how to use them and how they are different than a queue. A possible interview question is presented with a solution walk-through.
- [Instructor] Stacks are another structure in C++…that are a great place for interview questions.…A stack is a data structure that adds items to…the back of the list and retrieves them the opposite way.…If you think of a can of Pringles potato chips,…they are loaded from the top but the last chip…in is the first chip out.…First in, last out, or FILO.…In computer science it's expected to know how to…evaluate strings, either for natural language processing…or an expression written in pre or postfix notation.…
Postfix notation is an arithmetic expression with…the operators written after the operands.…Let's take a look at how you would approach evaluating…an arithmetic expression written in postfix notation…using a stack.…To use a stack in a program, we need to include…the stack library.…To declare a stack in our program we simply use…the stack key word, give it a data type, and then a name.…I've also declared a variable called expression…of type string, and I've given it…a postfix notation expression.…
Next I'll declare two variables to hold my two operands…
Released
2/8/2019- Getting ready for interviews
- Types of questions you can expect
- Comparing C and C++
- Polymorphism
- Inheritance
- Strings and arrays
- Linked lists
- Stacks and queues
- Classes
Share this video
Embed this video
Video: Stacks