MOOC/CS102 Introduction of CS2

Unit 5.1.2 John Guttag's "Recursion Lecture Notes"

soicem 2017. 1. 2. 19:32

 재귀에 대한 모든 것을 맛볼 수 있는 John Guttag 교수님의 "Recursion Lecture Note"를 리뷰합니다.



Recursion Implementation Topic


1. reetrant code

2. recursion vs iteration

3. relation of recursion to the functional and imperative programming paradigm

4. common mistakes in programming recursion


Structure of Recursive Implementation





1. base case  2. recursive step



Q. Recursive methods have a base case and recursive step what other concepts from computer science also have a base case and Recursive step


1. proof by inductive  2. binary trees



Helper Method's feature


1. support original Recursive function  2. must be hidden


Reetrant Code


"It can be called again even while a call to it is underway"


When to use Recursion rather than Iteration.


1. the problem is naturally recursive

2. the data is naturally recursive

3. take more advantage of immutability


Recursive function.pdf

강의 노트를 보기 이전 연구실 세미나때 재귀에 관련해 발표한 내용입니다.



 재귀의 기초적인 내용을 쉽게 설명한 강의 노트란 생각이 듭니다.  재귀 구조, 리엔트런트 코드 같이 재귀와 관련한 생소한 개념을 알 수 있습니다.  특히 subsequences에서 도움 메소드인 afterSubsequences를 사용하는 부분이 코드 작성 시 도움될 듯 합니다.  functional programming과 관련된 부분도 언급되는데, immutable한 객체와 input, output만으로 데이터를 주고받는 것이 side effect를 줄여줍니다.  이때, 해당 함수를 다시 사용하는 경우가 발생합니다.  하나도 빠뜨릴 거 없이 좋은 내용 !