ITT: Any Forums design a hash function
ITT: Any Forums design a hash function
The hash is the pointer of the key
Only internalized strings can be used as keys
do
hash;
Hashtables are the biggest scum ever, on big data it's slow af, it's only usable when you're solving interview questions. That's why everyone prefers self balancing trees over that garbage.
Identity.
strlen()
congrats on designing the trash that no one will use because of the dumb limitation
(define* (hash str #:optional (size #f))
((lambda (val)
(if size
(modulo val size)
val))
(string-fold (lambda (char prev)
(let ((i (char->integer char)))
(if (odd? i)
(+ prev i)
(* prev i))))
1
str)))
rate my hash function Any Forums
I cant code but it looks ok
hash(key) -> reduce(f -> sleep(f), key).
data -> my penis > result
cool thread
Not my algorithm but here's one
int hashing_function(char *string) {
int hash = 0;
for (int i = 0; string[i] != '\0'; i++) {
// hash = hash*33 + string[i];
hash += (hash
8/10 bait almost replied
but of course, you need to get the modulo of this, with the right argument being the size of the array, if you want to make a hash table implementatino
So hash tables are not dog shit?
dict = {}
$hash{first_key} = "value"
What language is this?
looks like scheme? I'm more of a CL user myself
It's either LISP or a variant of it
not him, but of course not. if you don't care about order, they are faster than self-balancing trees by a factor of log(N), which is huge for big datasets.
For insertion or search?
Databases uses hash tables internally? I've heard that they a whole bunch of data structures internally, and a lot of trees
t. Haskellfag
It has uses in joins and partitioning, but not really for indexing since it doesn't support range queries and has bad locality for insertions
Very cool. What data structure is used for indexing then?
import hash
print(hash.do())