circularQueue
-
[자료구조] Stack과 Queue코딩(Coding)/자료구조 2020. 12. 23. 15:51
Stack과 Queue Stack 스택(Stack)은 기본적인 자료구조로 쌓아올린다는 개념으로 시작하며 접근방법은 언제나 목록의 끝에서만 일어난다. 위 그림처럼 스택은 데이터를 아래서부터 쌓아올리고 데이터들을 다시 불러올때는 가장 최근의 데이터가 호출된다. 이를 선입후출(LIFO - Last in First Out)이라고 한다. 해당 자료구조를 구현하기위해 정의해야할 메소드를 아래에 적어보겠다. push(data): 데이터를 저장할 때, 호출되는 메소드 pop(): 가장 위에있는 데이터를 반환하고 그 값을 삭제하는 메소드 getTop(): 가장 위에있는 데이터를 반환하는 메소드 isEmpty(): stack이 비어있는지를 확인하는 메소드 isFull(): stack이 꽉차있는지를 확인하는 메소드 prin..