java - Having trouble recursively calling my algorithm -
i'm writing divide , conquer algorithm i'm having trouble recursively calling it. says cannot find symbol method multiply , variables m, e, m
public class multiply { private static int randomint(int size) { int maxval = (1 << size) - 1; return (int)(math.random()*maxval); } public static int[] naive(int size, int x, int y) { int[] result = new int[3]; if (size == 1) { result[0] = x*y; } else { int m = size/2; int = x/2; int b = x % (int)math.pow(2,m); int c = y / (int)math.pow(2,m); int d = y % (int)math.pow(2,m); int e = multiply(a,c,m); int f = multiply(b,d,m); int g = multiply(b,c,m); int h = multiply(a,d,m); } return ((int)math.pow(2,2*m)*e) + ((int)math.pow(2,m)*(g+h)) + f; }
try multiply.naive(x,y,z)
instead of multiply(x,y,z)
Comments
Post a Comment