스택 (1) 썸네일형 리스트형 자료구조 3주차_스택 자료구조 3주차_스택 & 큐 스택(Stack) Last In First Out 되돌리기 할때 사용! push(data) : 맨 위에 데이터 넣기 pop() : 맨 위의 데이터 뽑기 peek() : 맨 위의 데이터 보기 isEmpty() : 스택이 비었는지 안 비었는지 여부 반환 📌 스택 구현 class Node: def __init__(self, data): self.data = data self.next = None class Stack: def __init__(self): self.head = None def push(self, value): new_head = Node(value) new_head.next = self.head self.head = new_head # pop 기능 구현 def pop.. 이전 1 다음