Sort:  

Why would you need a hash table?

I only used a stl vector for the contatiner because I didn't want to deal with dynamically allocated arrays of a particular size and then using memory allocation / deallocation in the pseudocode. I could've said

int fibs[n+1];

but ... there's something really dissatisfying about doing that when n is not known at run time ...

But if you mean that the hash function is the trivial

hash(i) = i

function and that you are saying that

fibs[hash(i)] <- F(i) where F(i) is the i'th Fibonacci number, then, yes, I suppose you could do that.

No, I said it is like a hash table... I didn't say that we need a hash table! What I meant is that the array is like a hash table that holds all of the Fibonacci numbers, and calling fibs[x] is like the hash function for it. The more I try to explain this, the less this resembles a hash table, so I'm going to stop right there, haha! It just reminded me of a hash table because you can look things up very quickly (just like you can look up each Fibonacci number very quickly because they are already calculated in an the array).

Coin Marketplace

STEEM 0.16
TRX 0.16
JST 0.032
BTC 59435.06
ETH 2521.75
USDT 1.00
SBD 2.42