6. แยกย่อย

The Camtasia Studio video content presented here requires JavaScript to be enabled and the latest version of the Macromedia Flash Player. If you are you using a browser with JavaScript disabled please enable it now. Otherwise, please update your version of the free Flash Player by downloading here.

 
รหัสที่ 6-23  เมท็อดคำนวณค่า ab mod m (มีปัญหาเมื่อ b มีค่ามาก)
  public static int powerMod(int a, int b, int m) {
    if (b == 0) return 1;
    return (a*powerMod(a, b-1, m)) % m;
  }
©2009 S.Prasitjutrakul