Y
Hacker News
new
|
ask
|
show
|
jobs
by
moregrist
66 days ago
In a trivial sense, arrays are hash tables with a hash function of the identity f(x)=x.
It’s just not particularly common (or helpful) to view them that way.
1 comments
dprkh
65 days ago
In LeetCode, it's a very common optimization. If your key values are dense, you use an array. If your key values are sparse, you use a dict.
link