본문으로 건너뛰기
노리터자유게시판
여기 사실 휴대폰 커뮤니티임.성지 시세, 알뜰폰 요금 비교표직접 모아 가격순으로 보여줌11-23 확인 · 판매처 55곳 · 요금제 3,341개

자유게시판

아니면 이거좀 해주라

if a recursion call is the last execuable statement in the algorithm, called tail recursion, it can easily be removed using iteration,

tail recursion is so named because the return point of each call is at the end of the algorithm.

thus, there are no executable statements to be executed after each call. to change a tail recursion to an iteration, we use the following steps ;

a) use a variable to replace the procedure call

b) use a loop with limit condition as the base case (or its complement)

c) enclose all executable statements inside the loop

d) change the recursive call to an appropriate assignment statement

e) use appropriate statement to reassign calues to parameters

f) return the value of the variable defined in step a

write the iterative version of the recursion factorial algorithm and test it by printing the value of factorial(5) and fac(20)

문제에 답이 있긴한데

일단 비쥬얼 스튜디오 좀 깔고 올께

신고
진범
Signature

백수

댓글 2

  1. 진범

    이건 대충 하겠는데

    write a recuresive algorithm tht finds all occurrenses of a substring in a string

    신고
  2. 진범

    망할 재귀

    신고

댓글 작성

로그인 후 댓글을 작성할 수 있음.로그인

사진을 여기로 끌어다 놓거나이미지 · 파일당 최대 1 MB