파이썬자료구조
-
[부캠] Python Data Structure카테고리 없음 2021. 1. 20. 23:07
스택(Stack) 큐(Queue) 튜플(Tuple) 집합(Set) 사전(dictionary) Collection 모듈 스택(Stack) -Last In Last Out 의 메모리 구조 -주로 리스트를 이용해서 스택을 구현함. a=[1,2,3,4,5] a.append(6) #stack에 push a.append(7) a.pop() #stack에서 pop 큐(Queue) - FIFO(First In First Out) 의 구조 - 리스트 또는 collection deque 모듈을 사용하여 구현 a=[1,2,3,4,5] a.append(6) #push a.pop(0) #제일 처음인 원소를 반환 from collections import deque a=deque() a.append(1) a.append(2) a..