Advanced Data Structures: Double Hashing

Поділитися
Вставка
  • Опубліковано 29 жов 2024

КОМЕНТАРІ • 23

  • @MaliaCamille
    @MaliaCamille 2 роки тому +21

    Video starts @ 5:30

  • @reddistone
    @reddistone Рік тому +2

    What does this have to do with double hashing?

  • @channelname9468
    @channelname9468 4 місяці тому

    why talk about linear probing in a video about double hashing

  • @isaacdouglas1119
    @isaacdouglas1119 3 роки тому +2

    Is the h1(k) supposed to be h1(x)?

    • @niemasd
      @niemasd  3 роки тому +1

      Woops, thanks, good catch! Yes it is

  • @yesyas5972
    @yesyas5972 7 місяців тому

    All clear, thanks

  • @kevinjosueraymundogarcia3029
    @kevinjosueraymundogarcia3029 4 роки тому +3

    Well explained video, thank you!

    • @johnmartin9294
      @johnmartin9294 3 роки тому

      Pro tip : watch movies on KaldroStream. I've been using it for watching loads of movies these days.

    • @coltenbraxton4326
      @coltenbraxton4326 3 роки тому

      @John Martin Definitely, I have been watching on kaldrostream for years myself =)

    • @bridgerhouston4131
      @bridgerhouston4131 3 роки тому

      @John Martin Yup, I have been watching on kaldrostream for years myself :)

    • @leroylevi7432
      @leroylevi7432 3 роки тому

      @John Martin yup, I've been watching on kaldroStream for years myself =)

  • @hhh1656
    @hhh1656 3 роки тому

    If we use digit floding method as hash function,then hash key for 70 is 7(7+0).where we have to insert key 70 as the table size Is 5

  • @pawmeowzing2906
    @pawmeowzing2906 4 роки тому +1

    what if after double hash there is collision too??

    • @niemasd
      @niemasd  4 роки тому +4

      You keep probing just as you would with Linear Probing. The only distinction between Double Hashing and Linear Probing is that, in Linear Probing, if you have a collision, you keep probing 1 slot over at a time until you find an open slot, whereas in Double Hashing, if you have a collision, you keep probing h2(k) slots over at a time until you find an open slot

    • @pawmeowzing2906
      @pawmeowzing2906 4 роки тому

      @@niemasd the question now is how about if we want to find back the key? Say first round it didn't find it, then how do it knows when to stop probing when searching?

  • @jacobtrombley7650
    @jacobtrombley7650 Рік тому

    You gave hash_function1(x) = x%5. Therefore, your hash_function2(x) = 1 + (hash_function1(x)/m)%(m-1) for 70 would be hash_function2(x) = 1 + ((x%5)/m)%(m-1) = 1 + ((70%5)/5)%(5-1) = 1 + (0/5)%4 = 1. Therefore, your hash_function2 is giving a different value than the one you computed (1 instead of 3). Maybe you meant hash_function2(x) = 1 + (x/m)%(m-1)? This would give you 1 + (70/5)%(5-1) = 1 + 14%4 = 3.

    • @niemasd
      @niemasd  Рік тому

      h(x) = x, not x%5. The %5 comes from converting the hash value (x) into a valid index in the array (which has a length of 5)

    • @jacobtrombley7650
      @jacobtrombley7650 Рік тому

      @@niemasd gotcha, I misunderstood for h(x) definition

  • @beegyoshi9292
    @beegyoshi9292 2 роки тому +1

    Wouldn't you want your second hash function to always output a number coprime to the length of the table for this to work? Otherwise you end up wasting space as when doing the "probing" step you could easily miss empty slots.

    • @yunoletmehaveaname
      @yunoletmehaveaname Рік тому +2

      You want to miss empty slots. You don't want clumping, like he says at the beginning.

  • @bwbs7410
    @bwbs7410 Рік тому +2

    you spent half the video talking about linear probing in a video titled double probing smh