• Pada Algoritma pencarian banyak yang bisa kita temukan atau gunakan. Ada Merge Sort, Quick Sort, Bubble Sort, dan...
  • Pada dasarnya algoritma searching banyak kita jumpai. Apalagi hanya untuk mencari nilai minimum dan nilai maximum...
  • Kalian pasti sudah tahu apa itu Deret Fibonacci, ya benar. (Padahal gak jawab). Tetapi pada pembahasan kali ini kita akan membuar program...
  • Metoda Pencarian Biner ( Binary Search) hanya bisa diterapkan jika data array sudah terurut. Pengurutan Array bisa menggunakan jenis sorting ...
  • Salah satu contoh tipe algoritma brute force lainnya adalah linear search (pencarian berurutan), Dikatakan demikian karena algoritma ini menggunakan ...

Tuesday, April 26, 2011

Rekursif : Example Programs with Recursive Multiplication (Contoh Program Perkalian dengan Rekursif)


Recursive means that a process can call itself. Recursive definition is actually contained in the procedures and functions. The difference is that the recursive call to itself can be, but the procedures and functions must be called by the caller procedures and functions. Recursive programming techniques are important and some programming languages ​​support the existence of this recursive process. In procedures and functions, the call to itself can mean an iterative process that can not be known when it will end.

Now I will make an example of multiplication program (axb = a + a + a +...+ a total b times) by using recursive. Multiplication recursively can be written as follows :
                (a x b) = a + a +...+a (sebanyak b kali)
       (a x b) = a + (a x (b-1))


that programming can be written as
kali(a,b) = a + (kali(a, (b-1)))

We can make a recursive function as follows :


For complete program can be downloaded at dyas sembilanpoeloeh
Hopefully helpful friend..

Jadilah yang pertama mengomentari

Post a Comment

Tutorial Algorithm and Programming ©Template Blogger Green by Dicas Blogger.

To Up