추상 데이터 타입: 연산 약정
도입됨| English | 의미 |
|---|---|
| stack/stæk/ | 스택 |
| queue/kjuː/ | 큐 |
What would explain this observation?
- A waiting-line simulation needs the oldest pending item first. A stack 栈 gives the most recent item first, so the operation contract matters.
- Start with a prediction. State the quantities or features you would compare, then decide what evidence could distinguish two explanations.
Build the model
- An abstract data type specifies values and operations independently of a particular implementation. A stack is last in, first out; a queue 队列 is first in, first out. A collection interface needs defined behaviour for empty and invalid operations.
- stack: A last-in-first-out abstract data type; queue: A first-in-first-out abstract data type.
일반적인 도착 순서 대기열을 모델링하는 구조는 무엇입니까?
난이도 1/5 · 100 코인 + 오늘 첫 완료 시 소액 보너스
대기열(FIFO)은 Queue 계약에 정확히 부합합니다: 뒤쪽에서 enqueue하고 앞쪽에서 dequeue합니다. Stack은 LIFO이며, 계약이 없는 구조는 신뢰할 수 있게 어떤 것도 모델링하지 못합니다.
각 전문 용어에 대한 정확한 의미를 매칭하시오.
난이도 2/5 · 140 코인 + 오늘 첫 완료 시 소액 보너스
정의를 사용하여 유사한 양과 과정을 구분하시오.
Choose evidence that can test it
- Choose the structure for the required access pattern. Complexity depends on implementation and assumptions: removing the first item from a shifting array differs from advancing a head pointer in a queue.
- Trace operation sequences by hand, then compare a program with the expected states. Test empty, singleton and repeated operations. State overflow behaviour if capacity is fixed.
이 경우 조사 또는 모델이 더 타당하게 만들 수 있는 두 가지 습관은 무엇인가?
난이도 2/5 · 140 코인 + 오늘 첫 완료 시 소액 보너스
조건과 가정을 명시하면 다른 사람이 정확히 작업을 재현할 수 있으며, 근거 증거를 기록하면 결론을 검증할 수 있습니다. 반대되는 결과를 숨기는 것은 잘못된 결론을 반박할 수 있는 증거를 제거하는 것이며, 한 번의 측정으로는 더 넓은 주장을 입증할 수 없습니다.
Work from known quantities
- State the known values and their units. Choose the relation because its assumptions fit this case, then rearrange before substitution.
- Known: enqueue A, B and C, then dequeue twice. A and B leave; C remains. After enqueue D there are two pending items, C then D. The same pushes on a stack would remove C then B.
A queue starts empty, receives 7 items and removes 4. Find the number remaining. Use the same sequence: known quantities → model → relation → substitution → unit and interpretation.
초기가 비어 있는 큐에 7개의 항목이 들어오고 4개가 제거될 때, 남은 항목의 수를 구하십시오.
난이도 2/5 · 140 코인 + 오늘 첫 완료 시 소액 보너스
결과값은 3 항목입니다.已知: 빈 Queue; 7 enqueue; 4 dequeue. 남은 수 = 7 - 4 = 3 항목. 도착 순서대로 최근 도착한 세 항목이 아직 대기 중입니다.
Check the conclusion and its limits
- An ADT is not a specific memory layout. A queue does not sort by priority unless its contract defines a priority queue.
- Return to the original observation. Explain what the result supports, which conditions it assumes, and one way to test a competing explanation.
Every queue automatically sorts items by priority. This claim is false: An ordinary queue releases items strictly in arrival order. Serving by importance is a PRIORITY queue - a different contract that must be stated explicitly.
Abstract data types: an operation contract: Choose the structure for the required access pattern. Complexity depends on implementation and assumptions: removing the first item from a shifting array differs from advancing a head pointer in a queue.
모든 큐(Queue)는 자동으로 항목을 우선순위에 따라 정렬합니다.
난이도 1/5 · 100 코인 + 오늘 첫 완료 시 소액 보너스
일반 Queue는 STRICTLY 도착 순서대로 항목을 방출합니다. 중요도에 따라 처리하는 것은 PRIORITY Queue이며, 이는 명시적으로 서술해야 하는 다른 계약입니다.
후입선출(LIFO) 추상 데이터 타입: 기술 용어를 쓰십시오.
난이도 1/5 · 100 코인 + 오늘 첫 완료 시 소액 보너스
스택(stack)은 마지막 입력이 가장 먼저 출력되는 추상 데이터 유형(LIFO)을 의미합니다.