Lesson 2: Stack & Queue - English
A stack is a data structure that is used in computer programming. It is a last-in-first-out structure. This structure can be best compared to a stack of papers. If a new item is added to the stack of paper, it's automatically at the top. When someone needs to be removed from the stack, it will pull the topmost paper off of the stack. Adding an element to the stack is known as a push operation, and removing an element is known as a pop operation. Peek or top are used to get the value of the next element that would be removed with a pop operation, without removing that element from the stack.
A queue is a first-in-first-out data structure. This means that the first element that is added to the queue will be the first element removed. Elements are added to the back of the queue with the enqueue operation, and elements are removed from the front of the queue with the dequeue operation. Peek or front are used to get the value of the next element that would be removed.