게시판 인덱스

 
 FAQFAQ   검색검색   멤버리스트멤버리스트   사용자 그룹사용자 그룹   사용자 등록하기사용자 등록하기 
 개인 정보개인 정보   비공개 메시지를 확인하려면 로그인하십시오비공개 메시지를 확인하려면 로그인하십시오   로그인로그인 

숙제2 테스트셋 복사붙여넣기 버전입니다

 
이 게시판은 잠겼으므로 글을 올리거나, 답변을 하거나 수정을 할 수 없습니다   이 주제는 잠겼으므로 답변을 하거나 수정을 할 수 없습니다     게시판 인덱스 -> 4190.210 Principles of Programming (Fall 2011)
이전 주제 보기 :: 다음 주제 보기  
글쓴이 메시지
유.강민



가입: 2011년 3월 22일
올린 글: 38

올리기올려짐: 2011년9월26일 21:32    주제: 숙제2 테스트셋 복사붙여넣기 버전입니다 인용과 함께 답변

1번)
(define mytree (node (list (leaf (list 'node 'leaf ())) (node (list (leaf 'node) (leaf (list 1 2 3)) (leaf ()))) (node (list (leaf ()) (leaf (list 'leaf ())) (leaf (list ())))))))
(equal? (is-empty-tree? mytree) #f)
(equal? (is-leaf? mytree) #f)
(equal? (is-leaf? (nth-child mytree 0)) #t)
(equal? (leaf-val (nth-child mytree 0)) '(node leaf ()))
(equal? (is-leaf? (nth-child mytree 1)) #f)
(equal? (is-leaf? (nth-child (nth-child mytree 1) 1)) #t)
(equal? (leaf-val (nth-child (nth-child mytree 1) 1)) '(1 2 3))
(equal? (leaf-val (nth-child (nth-child mytree 1) 0)) 'node)
(equal? (leaf-val (nth-child (nth-child mytree 1) 2)) '())
(equal? (is-empty-tree? (nth-child (nth-child mytree 1) 2)) #f)
(equal? (leaf-val (nth-child (nth-child mytree 2) 0)) '())
(equal? (leaf-val (nth-child (nth-child mytree 2) 1)) '(leaf ()))
(equal? (leaf-val (nth-child (nth-child mytree 2) 2)) '(()))
(equal? (is-empty-tree? (leaf ())) #f)
(equal? (is-empty-tree? (node ())) #t)
(equal? (is-empty-tree? (node (list (leaf ()) (node ())))) #f)
(equal? (is-empty-tree? (nth-child (node (list (leaf ()) (node ()))) 1)) #t)

2번)
(equal? (weight (make-mobil (make-branch 12 (make-mobil (make-branch 3 (make-mobil (make-branch 2 (model 2)) (make-branch 2 (make-mobil (make-branch 3 (model 1)) (make-branch 3 (model 1)))))) (make-branch 6 (model 2)))) (make-branch 18 (make-mobil (make-branch 3 (model 1)) (make-branch 1 (model 3)))))) 10)
(equal? (is-balanced? (make-mobil (make-branch 12 (make-mobil (make-branch 3 (make-mobil (make-branch 2 (model 2)) (make-branch 2 (make-mobil (make-branch 3 (model 1)) (make-branch 3 (model 1)))))) (make-branch 6 (model 2)))) (make-branch 18 (make-mobil (make-branch 3 (model 1)) (make-branch 1 (model 3)))))) #t)
(equal? (is-balanced? (make-mobil (make-branch 12 (make-mobil (make-branch 3 (make-mobil (make-branch 3 (model 2)) (make-branch 2 (make-mobil (make-branch 3 (model 1)) (make-branch 3 (model 1)))))) (make-branch 6 (model 2)))) (make-branch 18 (make-mobil (make-branch 3 (model 1)) (make-branch 1 (model 3)))))) #f)
(equal? (is-balanced? (make-mobil (make-branch 12 (make-mobil (make-branch 3 (make-mobil (make-branch 2 (model 2)) (make-branch 2 (make-mobil (make-branch 3 (model 1)) (make-branch 3 (model 1)))))) (make-branch 4 (model 3)))) (make-branch 18 (make-mobil (make-branch 3 (model 1)) (make-branch 1 (model 3)))))) #f)


3,4번)

(equal? (let ((logic (lambda (a b c d) (output (or-circuit (or-circuit (and-circuit (and-circuit (not-circuit a) b) (not-circuit c)) (and-circuit (and-circuit (not-circuit a) (not-circuit c)) d)) (and-circuit (and-circuit (not-circuit a) (not-circuit b)) (and-circuit c (not-circuit d))))))))
(list
(logic zero zero zero zero)
(logic zero zero zero one)
(logic zero zero one zero)
(logic zero zero one one)
(logic zero one zero zero)
(logic zero one zero one)
(logic zero one one zero)
(logic zero one one one)
(logic one zero zero zero)
(logic one zero zero one)
(logic one zero one zero)
(logic one zero one one)
(logic one one zero zero)
(logic one one zero one)
(logic one one one zero)
(logic one one one one))) '(0 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0))
(equal? (let ((logic (lambda (a b c d) (output (or-circuit (or-circuit (and-circuit b (not-circuit c)) (and-circuit (not-circuit a) b)) (and-circuit (and-circuit a (not-circuit b)) (and-circuit c d)))))))
(list
(logic zero zero zero zero)
(logic zero zero zero one)
(logic zero zero one zero)
(logic zero zero one one)
(logic zero one zero zero)
(logic zero one zero one)
(logic zero one one zero)
(logic zero one one one)
(logic one zero zero zero)
(logic one zero zero one)
(logic one zero one zero)
(logic one zero one one)
(logic one one zero zero)
(logic one one zero one)
(logic one one one zero)
(logic one one one one))) '(0 0 0 0 1 1 1 1 0 0 0 1 1 1 0 0))


유.강민 가 2011년9월28일 10:08에 수정함, 총 1 번 수정됨
위로
사용자 정보 보기 비밀 메시지 보내기
안준형



가입: 2011년 9월 7일
올린 글: 18

올리기올려짐: 2011년9월28일 0:31    주제: 2-2 테스트셋에 함수 이름이 make-mobile 이 아니라 make-mobil 아닌가요! 인용과 함께 답변

아닌가요!
위로
사용자 정보 보기 비밀 메시지 보내기
강현수



가입: 2011년 9월 27일
올린 글: 16

올리기올려짐: 2011년9월28일 0:37    주제: Thank you much man 인용과 함께 답변

Razz
make-mobile빼고 ㅋㅋ
위로
사용자 정보 보기 비밀 메시지 보내기
안준형



가입: 2011년 9월 7일
올린 글: 18

올리기올려짐: 2011년9월28일 0:54    주제: 그리고 테스트셋 2-3 번 #f가 아니라 #t 같은데! 인용과 함께 답변

둘다 계싼해보면 72나오는데...
위로
사용자 정보 보기 비밀 메시지 보내기
유.강민



가입: 2011년 3월 22일
올린 글: 38

올리기올려짐: 2011년9월28일 10:09    주제: RE 인용과 함께 답변

make-mobile고쳤어요
그리고 2-3번은 하위 모빌도 체크했나요?
위로
사용자 정보 보기 비밀 메시지 보내기
엄태건



가입: 2011년 9월 27일
올린 글: 50

올리기올려짐: 2011년9월29일 19:21    주제: Re: 숙제2 테스트셋 복사붙여넣기 버전입니다 인용과 함께 답변

감사합니당.
위로
사용자 정보 보기 비밀 메시지 보내기 AIM 주소
이전 글 표시:   
이 게시판은 잠겼으므로 글을 올리거나, 답변을 하거나 수정을 할 수 없습니다   이 주제는 잠겼으므로 답변을 하거나 수정을 할 수 없습니다     게시판 인덱스 -> 4190.210 Principles of Programming (Fall 2011) 시간대: GMT + 9 시간(한국)
페이지 11

 
건너뛰기:  
새로운 주제를 올릴 수 없습니다
답글을 올릴 수 없습니다
주제를 수정할 수 없습니다
올린 글을 삭제할 수 없습니다
투표를 할 수 없습니다


Powered by phpBB 2.0.21-7 (Debian) © 2001, 2005 phpBB Group
Translated by kss & drssay