Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create DFS-Orgenus #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions DFS-Orgenus
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
(define myTree (list 53 (list 23 (list 11 '() '()) (list 4 '() '()) ) (list 17 '() '())))


(define (node agac)( car agac))
(define (left agac)( car (cdr agac)))
(define (right agac)( car (cdr (cdr agac))))

(define (esitmi a b c d)(

cond [(= a b) b]
[(= a c) c]
[(= a d) d]
[else 0]

))
; Hocam counter olmadı :(
(define (DFS agac sayi n)(

if(empty? agac)
0
(

cond [(= sayi (esitmi sayi
(node agac)
(DFS (left agac) sayi (+ n 1))
(DFS (right agac) sayi (+ n 1)))) n]
[else 0]


)


))


(DFS myTree 24 0)
(DFS myTree 4 0)