help me turn my code into the recursion traingle algorithm!
2b_pascal_triangle.asm @ + X 1 section .text 2 3 global combi ik 3 ecx in-1 6 ; ECX = n, EDX = k, returns result in EAX, no other register modified 7 ; (_msfastcall-like convention, but extended to preserve ECX+EDX) 8 combi: ; cen, k) c(n-1, k-1) + c(n-1, k), c(i, e) = c(i, i) = 1 9 test edx, edx 10 je .basecases ; c(i, e) = 1 11 стр edx, ecx ; k se n 12 je .basecases ; c(i, i) = 1 13 ; <k<n case: 14 dec 15 call combi ; EAX = c(n-1, k) 16 push esi 17 esi, eax ; keep c(n-1, k) in EST 18 dec edx 19 call combi ; EAX = c(n-1, k-1) 20 add eax,esi ; EAX = c(n-1, k-1) + c(n-1, k) 21 ; restore all modified registers 22 pop esi 23 inc 24 inc edx ret ; return result in EAX .basecases: 27 eax,1 28 ret mov ; k-1 卫四昭昭四明丑&四四四拍四四四 ecx 26 mov
help me turn my code into the recursion traingle algorithm!
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
help me turn my code into the recursion traingle algorithm!
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!