일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
- 리덕스
- SQL 고득점 Kit
- codestates
- Async
- til
- 알고리즘
- 리액트
- 렛츠기릿 자바스크립트
- 2주 프로젝트
- 제로초
- 코드스테이츠
- programmers
- 4주 프로젝트
- 리트코드
- 회고
- 파이썬
- 타임어택
- LeetCode
- js
- 코어 자바스크립트
- javascript
- python
- 백준
- 정재남
- 타입스크립트 올인원
- 토익
- 프로그래머스
- 손에 익히며 배우는 네트워크 첫걸음
- 자바스크립트
- 타입스크립트
- Today
- Total
Jerry
One Paper: Stack & Queue 본문
* 필요한 문장으로 판단되는 경우에 발췌했으며, 출처 표기를 준수하였습니다.
1. Stack
-
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.
- A stack is needed to implement depth-first search.
1.1 History
- Stacks entered the computer science literature in 1946, when Alan M. Turing used the terms "bury" and "unbury" as a means of calling and returning from subroutines. [3][4] Subroutines had already been implemented in Konrad Zuse's Z4 in 1945.
1.2 Software stacks
Implementation
- A stack can be easily implemented either through an array or a linked list. What identifies the data structure as a stack, in either case, is not the implementation but the interface: the user is only allowed to pop or push items onto the array or linked list, with few other helper operations.
1.3 Hardware stack
- A common use of stacks at the architecture level is as a means of allocating and accessing memory.
source: Stack (abstract data type)
1.4 Question: Working of Stack Data Structure
*바로 밑에 출처에 있는 글을 보았다. top이 당연히 (시작값 할당을) 0이라고 알고 있었는데 아니었다. queue 또한 아니었다. 과제에서도 stack: top, queue: front가 0이라고 되어있었는데 이런 의도가 궁금해서 질문을 남겼다.
질문: https://github.com/codestates/help-desk/issues/2197
질문 내용:
source: Stack Data Structure
2. Queue
- In computer science, a queue is a collection of entities that are maintained in a sequence and can be modified by the addition of entities at one end of the sequence and the removal of entities from the other end of the sequence.
- The operations of a queue make it a first-in-first-out (FIFO) data structure. In a FIFO data structure, the first element added to the queue will be the first one to be removed.
- Common implementations are circular buffers and linked lists.
source:Queue (abstract data type)
source: Queue Data Structure
'Problem Solving > Algorithm 개념 익히기' 카테고리의 다른 글
Javascript_자바스크립트_sort_메서드 (0) | 2022.01.14 |
---|---|
[Algorithm]Divide and Conquer & greedy: 분할 정복과 탐욕법에 대해 알아보자! (0) | 2021.06.07 |
[Algorithm] DFS / BFS 에 대해 알아보자! (0) | 2021.06.02 |
[Algorithm] Stack & Queue: 스택과 큐에 대해 알아보자! (0) | 2021.06.01 |
One Paper: Linked List (0) | 2020.10.24 |