You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def dfs(elements):
# 리프 노드일때 결과 추가
if len(elements) == 0:
results.append(prev_elements[:])
# 순열 생성 재귀 호출
for e in elements:
next_elements = elements[:]
next_elements.remove(e)
prev_elements.append(e)
dfs(next_elements)
prev_elements.pop()
위는 책에 소개된 code인데요.
재귀에 대하여 이해를 못하고 있습니다.
처음 순열을 만들고(prev_elements가 [1,2,3]인 상태), prev_elements.pop()에 의해서 2, 3이 제거되는데 왜 2 번 일어나는 건가요?
질문이 어설프면 힌트라도 주세요..
감사합니다.
The text was updated successfully, but these errors were encountered:
위는 책에 소개된 code인데요.
재귀에 대하여 이해를 못하고 있습니다.
처음 순열을 만들고(prev_elements가 [1,2,3]인 상태), prev_elements.pop()에 의해서 2, 3이 제거되는데 왜 2 번 일어나는 건가요?
질문이 어설프면 힌트라도 주세요..
감사합니다.
The text was updated successfully, but these errors were encountered: