Yinelemeli kuvvet yükseltme nasıl yapılır?

ily

Zeptopat
Katılım
18 Mayıs 2021
Mesajlar
1
Daha fazla  
Cinsiyet
Kadın
It is easy to implement an iterative function raiseIntToPower that computes n raised to the kth power:

Rewrite this function so that it operates recursively, taking advantage of the following insight:
• If k is even, nkis the square of n raised to the power k / 2.
• If k is odd, nkis the square of n raised to the power k / 2 times n.
In solving this problem, you need to identify the simple cases necessary to complete the recursive definition.

Bunu bir türlü yapamadım acaba yardımcı olabilir misin? @berkay
 
Son düzenleyen: Moderatör:

Geri
Yukarı