true, would be better for efficiency.
Type: Posts; User: keepStriving
true, would be better for efficiency.
Finally got it, got my answer too. Thank you for bearing with me.
public static BigInteger fibonnaci(int n){
BigInteger bd = new BigInteger("-1");
//if n==0||n==1
if(n==0||n==1){...
Changed it to this still get problems, though I understand its not processing "if in memory" right, I'll get there eventually.
//if in memory, if greater than -1, meaning has a value other than...
"-1" was meant to symbolise that certain value fibonacci value has been added. Though I think where I have gone is that when I tried this with array I had a mapping between "i" in the array and...
You are right, the fibonacci works as I've tested for some numbers though something has going wrong with storage I think which is why it's taking so long for greater numbers.
Sorry about the delay. Its for a project Euler problem, consumes a lot of memory.
import java.math.BigInteger;
import java.util.HashMap;
import java.util.Map;
public class ProjectEuler{...
Thank you so much, got it.
Under the "if not in memory" comment.
mapping.put(n,bg);
I'm trying to compute fibonacci for extremely large numbers so I'm using memoization and BigInteger.
The trouble is I can't get it to work. I keep getting output -1 for all except the first and...