스택
#스택개념
- 입력과 출력을 한 방향으로 제한한 알고리즘
- 바닥부터 데이터를 차곡차고 쌓는 개념
- LIFO(Last In First Out)
#구조

#스택코드
#!/usr/bin/python
def push(item):
stack.append(item)
def pop():
return stack.pop()
if __name__ == '__main__':
stack = []
push(1)
push(2)
push(3)
push(4)
print("현재 stack의 모습")
print(stack)
while stack:
print("POP > {}".format(pop()))
큐
#큐개념
- 그릇을 쌓아 놓는 알고리즘
- 데이터를 저장해 놓을 메모리 공간이 필요
#구조

#큐코드
#!/usr/bin/python
def put(item) :
queue.append(item)
def get():
return queue.pop()
if __name__ == '__main__':
queue = [] # queue create
put(1)
put(2)
put(3)
put(4)
print("현재 queue의 모습")
print(queue)
while queue:
print("POP > {}".format(get()))