Update for 03-05-22 20:45

This commit is contained in:
Tyler Perkins 2022-05-03 20:45:01 -04:00
parent 10fd98e155
commit 3705b2634e
3 changed files with 18 additions and 0 deletions

View File

@ -90,5 +90,6 @@ Different ways to store and operate on data, with differing efficiency
== Misc == == Misc ==
* [[p_vs_np]] * [[p_vs_np]]
* [[quadratic_probing]]
[[index]] [[index]]

View File

@ -11,6 +11,7 @@ flavors.
== Bad for == == Bad for ==
* Non basic data types (unless you create a really good hash function) * Non basic data types (unless you create a really good hash function)
* also see [[quadratic_probing]]
== Optimize == == Optimize ==

View File

@ -0,0 +1,16 @@
= Quadratic Probing =
Quadratic probing is a scheme for resolving hash collisions in [[hash_table]]s.
It operates by taking the original hash index and adding sucessive values of an
arbitrary quadratic polymoial until an open solt is found.
== Example ==
For some `h(k)` that is a hash function, mapping to the keyspace [0, m-1],
where m is the size of a hash table, let the _i_th probe position for some _k_
be,
{{{
h(k,i) = h(k) + c1i + c2i^2 mod m
}}}
Where c2 != 0 and c1 and c2 are constants.