<aside> 💡 필요한 문장으로 판단되는 경우에만 따로 발췌했습니다.
</aside>
In computer science, a stack is an abstract data type that serves as a collection of elements, with two main pricipal operation(push, pop)
abstract data type is a mathematical model for data types.
An abstract data type is defined by its behavior (semantics) from the point of view of a user, of the data, specifically in terms of possible values, possible operations on data of this type, and the behavior of these operations.
Example: abstract stack (functional)
For example, a complete functional-style definition of an abstract stack could use the three operations:
push: takes a stack state and an arbitrary value, returns a stack state;
top: takes a stack state, returns a value;
pop: takes a stack state, returns a stack state.
The order in which elements come off a stack gives rise to its alternative name, LIFO(last in, first out).
It is similar to a stack of plates, adding or removing is only possible at the top.
Considered as a linear data structure, or more abstractly a sequential collection, the push and pop operations occur only at one end of the structure, referred to as the top of the stack.
This data structure makes it possible to implement a stack as a singly linked list and a pointer to the top element.
A stack may be implemented to have a bounded capacity. If the stack is full and does not contain enough space to accept an entity to be pushed, the stack is then considered to be in an overflow state. The pop operation removes an item from the top of the stack.
Implementation
source
*바로 밑에 출처에 있는 글을 보았다. top이 당연히 (시작값 할당을) 0이라고 알고 있었는데 아니였다. queue 또한 아니였다. 과제에서도 stack: top, queue: front가 0이라고 되어있었는데 이런 의도가 궁금해서 질문을 남겼다.
질문: https://github.com/codestates/help-desk/issues/2197 질문 내용: