8. Randomization: Universal & Perfect Hashing

แชร์
ฝัง
  • เผยแพร่เมื่อ 4 ม.ค. 2025

ความคิดเห็น • 59

  • @shivjyotigarai2141
    @shivjyotigarai2141 3 ปีที่แล้ว +20

    Perfect Hashing starts from ABOUT 55:00

  • @stormanning1163
    @stormanning1163 7 ปีที่แล้ว +50

    Perfect Hashing: @56:17

  • @lobstr17
    @lobstr17 2 ปีที่แล้ว +10

    I like this guy. Finally someone who explains how to find the size for the second hash table! I wish I went to MIT

  • @marcanthonybruno6022
    @marcanthonybruno6022 7 ปีที่แล้ว +22

    this is the best video I have ever seen on HASHING, HASHING gets my armpits moist on Tuesdays!

  • @corinachen4954
    @corinachen4954 5 ปีที่แล้ว +6

    thank you mit for teach me stuff that my lecturer should

  • @mytennisjourney4949
    @mytennisjourney4949 3 ปีที่แล้ว +4

    It’s amazing.I’m so excited for understanding the proof. Math from 6042 is really helpful.Thanks MIT!

  • @DenisG631
    @DenisG631 8 ปีที่แล้ว +12

    Great explanation!
    And BTW the video quality is just awesome :)

  • @ViktorEngelmann
    @ViktorEngelmann 3 ปีที่แล้ว +3

    There are so many useless videos on this topic. Finally a video that explains it well, beyond a rough idea of what hashing /is/ and a trivial implementation!

    • @ViktorEngelmann
      @ViktorEngelmann 3 ปีที่แล้ว +1

      btw. I think we've met at STACS 2007 in Aachen :-D

  • @김주홍-d4h
    @김주홍-d4h 7 หลายเดือนก่อน

    27:17
    I think n/m might be (n-1)/m, cause number of k != l is n-1.
    I'm I right?

  • @aquilazyy1125
    @aquilazyy1125 3 ปีที่แล้ว +1

    14:10 That is an unexpected stab to my heart...

  • @jimmypi7
    @jimmypi7 5 ปีที่แล้ว +1

    Dear All,
    I just checked the CLRS book and also listened to this lecture.
    I think there is one step they did not elaborate: how can universal hashing be repeatable?
    after I map a particular key k-particular to a slot,
    if I look it up in the future, how do I get the "a" that was choosed randomly to do dot product with k-particular?
    ps. "a" here means :
    569 00:35:40,680 --> 00:35:45,690 But the hash family h is just all of these ha's
    570 00:35:45,690 --> 00:35:48,560 for all possible choices of a.
    571 00:35:52,276 --> 00:35:56,860 a was a key so it comes from the universe u.

    • @darkclone5738
      @darkclone5738 5 ปีที่แล้ว +5

      If you haven't yet found your answer:
      When you build the hash table and generate the hash function(s) (by choosing a random 'a') you store and re-use the 'a'.
      'a' is not chosen randomly for each k-particular. You choose one 'a' for each hash function you use. The main idea is randomly choosing a hash function (by selecting a random 'a') to more likely get a random distribution of the keys across the bins, instead of assuming keys are random and having a static hash function.

  • @michelleslee8040
    @michelleslee8040 5 ปีที่แล้ว +12

    love it but v curious about the frisbees o_____o

  • @monsteryoutube8327
    @monsteryoutube8327 11 หลายเดือนก่อน

    It's great to see to much people typing that it's a fantastic video. But, why i get stuck to many times because the formulas and theorems? Would someone tell me how improve it ?

  • @user-jj6tw3gv1z
    @user-jj6tw3gv1z 2 ปีที่แล้ว +1

    Perfect and precise explanation! Thanks so much

  • @hasparus
    @hasparus 6 ปีที่แล้ว +1

    jesus, Demaine is amazing

  • @belightar9079
    @belightar9079 3 ปีที่แล้ว

    This edition, personally I think, is better than 2020 edition

  • @mond2440
    @mond2440 6 ปีที่แล้ว +1

    44:12 those two sums only need to be equivalent modulo m, not equal. So I don’t get your demonstration.

    • @halfEnlightenedOne
      @halfEnlightenedOne 3 ปีที่แล้ว

      For future viewers:
      It does not matter.
      Just replace = 0 with (c1 - c2) x m
      which will eventually become
      ad = f(...) with f containing a term for cm.

  • @sumitsinghchauhan2425
    @sumitsinghchauhan2425 7 ปีที่แล้ว +1

    Perfect hashing, great explanation

  • @cparks1000000
    @cparks1000000 4 ปีที่แล้ว +2

    Step 50:00 is really Fubini's theorem in disguise.
    This lecture was brilliant.

    • @Thien--Nguyen
      @Thien--Nguyen 4 ปีที่แล้ว +1

      Hey can you elaborate on Fubini?
      I just got this: Pr{a_d = -(k_d-k'_d)^{-1}*∑a_i*(k_i-k'_i)} = (independence of a_d from a_i) = Pr(f(a_d))*Pr(f(k,k',a_i not d)) = E_{a_i}[Pr{a_d=f(...)]. Would appreciate any insight!

    • @cparks1000000
      @cparks1000000 4 ปีที่แล้ว

      @@Thien--Nguyen The expected value of a random variable is actually an integral over a probability space. This requires measure theory to fully appreciate.

    • @Thien--Nguyen
      @Thien--Nguyen 4 ปีที่แล้ว

      Hmm. Can you give me a hint? I know that E[X] = ∫_V xf(x)dx where V is the space that X maps to and f is the pdf. I know a bit of measure theory but a bit rusty on probability so can you point me to a source? Thank you in advance!

  • @pnachtwey
    @pnachtwey 6 ปีที่แล้ว +5

    Finally, the instructor starts with "why bother!" It would have helped to have an example for the universal hashing. I also wonder about how practical the perfect hashing is if u is extremely large like the number of chess positions. Obviously perfect hashing wouldn't work for chess position because they are updated all the time.
    You don't know hashing until you have really done it. Not all applications lend themselves to the formulas.

  • @AkshayAradhya
    @AkshayAradhya 5 ปีที่แล้ว

    10:55 Correction, when he says a[1] he means to say a[0] which is the first element in the array.

    • @gravity6316
      @gravity6316 ปีที่แล้ว +1

      hey Ive seen your answers on graph theory on stack exchange ....small world

  • @DheemanSaha
    @DheemanSaha 4 ปีที่แล้ว

    I am confused when the dot product is performed on the Universal Hashing algorithm. Why there we are considering k_d - k'_d = 0 and is not (mod m) of that is also 0.

    • @halfEnlightenedOne
      @halfEnlightenedOne 3 ปีที่แล้ว

      It does not matter.
      Just replace = 0 with (c1 - c2) x m
      which will eventually become
      ad = f(...) with f containing a term for cm.

  • @sudattabhattacharya7927
    @sudattabhattacharya7927 6 ปีที่แล้ว

    Isn't u the number of all possible hash functions? all possible keys is different

  • @shivamrana4633
    @shivamrana4633 5 หลายเดือนก่อน

    Looking over this lecture.. i wish to be in MiT😢

  • @simpleffective186
    @simpleffective186 4 ปีที่แล้ว

    this is GOLD.

  • @tomwu163
    @tomwu163 7 ปีที่แล้ว

    Can anybody explain to me, why n people with n^2 birthdays gives a collision probability of 1/2?

    • @foobargorch
      @foobargorch 7 ปีที่แล้ว

      n people have n^2 chances of sharing a birthday, because each person has n chances of sharing a birthday with someone. Adjusting for double counting (two people share a single chance), by counting the probability of *not* having a match, the formula for p is 1 - ( n! * (m choose n) ) / (m^n). if m = 365, then for the probability of a collision to be 1/2, n actually has to equal 23 (actually it's p = 50.7%).

    • @现代化孤儿
      @现代化孤儿 7 ปีที่แล้ว

      This website explains very well: mathforum.org/dr.math/faq/faq.birthdayprob.html

    • @Adam-zh6qr
      @Adam-zh6qr 7 ปีที่แล้ว

      But how's 23^2 365? Also when you substitute n^2 for m in your equation, it is not a constant.

    • @sudarshanh.v993
      @sudarshanh.v993 4 ปีที่แล้ว

      Discrete Math course was a prerequisite. In fact, if you had taken the MIT ocw 6.042J course, the number theory and math part becomes waaaay more easier. Look up the 6.042J course. Tom Leighton does an amazing job at explaining the Birthday Problem in Lecture 20

    • @hix0071
      @hix0071 4 ปีที่แล้ว

      @@sudarshanh.v993 Thanks man for the course name. Shall do it.

  • @luojihencha
    @luojihencha 4 ปีที่แล้ว

    Why log n trail whp?

    • @pervognsen_bitwise
      @pervognsen_bitwise 4 ปีที่แล้ว

      You can see the calculation here. It uses Chernoff bounds. courses.csail.mit.edu/6.856/17/Notes/n8-balls-bins.html

    • @paulogsf76
      @paulogsf76 ปีที่แล้ว

      Also didn't get that. If Pr[total space of 2nd level linear] > 1/2 (for some constant we get to choose which does not depend on the absolute value of n), then I think that we'd have Pr[#trials until we get linear space > t] < 1/2^t, that is Pr[#trials > lg s] < 1/s (with s=2^t) which is whp on s which has nothing to do with n imho. I don't see how it would depend on n. What am I missing?

  • @jayhoeliotdecabrio4050
    @jayhoeliotdecabrio4050 3 ปีที่แล้ว

    what is clrs

    • @lula4148
      @lula4148 2 ปีที่แล้ว

      it's the book introduction to algorithms by clrs which lots of universities use for their courses

  • @dtrade4787
    @dtrade4787 6 ปีที่แล้ว +2

    La'ash got me rolling! Best prof ever

  • @maoqiutong
    @maoqiutong 6 ปีที่แล้ว

    One key may be hashed multiple times when using a hash table to insert an item, search for the item and finally delete it. So, there is a problem that how can i guarantee the hash code stays the same each time the key is hashed using randomized hashing? For example, how can i make sure the dot product hash function uses the same vector a (a1, a2, ..., ar-1) for the same key (k1, k2, ..., kr-1) at different times?

    • @93nites
      @93nites 6 ปีที่แล้ว +2

      Only when we are doubling/halving the table we make the random choice. Once chosen, same hash function (vector a in the example) will be used for all subsequent hashes until next doubling/halving. And yet the analysis is correct for O(1+n/m)!

  • @henryzhu7309
    @henryzhu7309 4 ปีที่แล้ว

    proof of universal hashing seems confusing

  • @tianxiaoyang1123
    @tianxiaoyang1123 8 ปีที่แล้ว +1

    really good

  • @mehmetaliozer2403
    @mehmetaliozer2403 4 ปีที่แล้ว

    Is it true that you are accepting the 500th person who liked this video as a visitor to your lesson in mit? :D