
[자료구조] Recursion 재귀
·
Study/자료구조
Recursion : when a method call itself 자기자신을 불러 반복하여 결과 값을 업데이트하는 것 loop문 없이 본인을 호출하여 반복문이 된다. 끝에 도달하면 return하는 값이 정해져있다. 표현법이 단순하고, 복잡한 문제를 간단하게 해결할 수 있다. but, 이해하는게 어려울 수 있다. 재귀로 간단하게 해결할 순 있지만 쉬운건 아님!!!! Base case : Values of the input variables for which we perform no recursion calls are called base cases (there should be at least one base case). : Every possible chain of recursive calls must..