Hashing | Set 3 (Open Addressing) | GeeksforGeeks

Поделиться
HTML-код
  • Опубликовано: 13 янв 2025

Комментарии • 113

  • @RishabhSairawat
    @RishabhSairawat 7 лет назад +163

    All your videos are good when we watch them in "1.5x speed" :-)

  • @hariharanpolasa7994
    @hariharanpolasa7994 Год назад +1

    Simple, To the point covering all the important topics ..Kudos to gfg!

  • @shobhitparashari3778
    @shobhitparashari3778 5 лет назад +8

    Nice explanation,
    I really liked the way you explained.
    Just one thing which can be added... please demonstrate search and delete attempt for non-existing key only... for example attempt to search key=8 in linear probing and show where to stop searching in both cases (1-all keys are occupied, 2 hash table has some empty slots)

  • @rahulkhandelwal8781
    @rahulkhandelwal8781 8 лет назад +5

    At 5:44 shouldn't it be h1(18)=h1(((18%11)+1)%11) and not h1((18+1)%11), as the formula is (Hash(x)+i)%size. The formula applied here worked as we are taking mod here but had the key been a string or had we used some other operation other than mod the probe would not be correct.

    • @GeeksforGeeksVideos
      @GeeksforGeeksVideos  8 лет назад +1

      Hey Rahul,
      The point you are making is correct, we have skipped calculations as (X%t + i) % t = (X+i) % t for i >= 0.
      And, yes, Hash(X) can be any suitable function depending on the type of keys that we are dealing with.

    • @flyingtiger9988
      @flyingtiger9988 8 лет назад +3

      I think it is not good to simplify this step which makes the listeners confused. Hope you can modify it later. Probably, calculating Hash(key) first, then do (Hash(key) + i) % size. :-)

    • @GeeksforGeeksVideos
      @GeeksforGeeksVideos  8 лет назад +1

      Thank you for your feedback, Yanbo.
      We will do something about this in the coming days.

    • @memer7867
      @memer7867 3 года назад

      @@GeeksforGeeksVideos what is ILLUMINATI ?

  • @beypazariofficial
    @beypazariofficial 3 года назад

    straight reading from your website. effortless

  • @jackkalman8195
    @jackkalman8195 7 лет назад +1

    could you explain how you calculated the expected time to search/insert/delete ? 10:49

  • @sukumarbabudhanasekar6762
    @sukumarbabudhanasekar6762 7 лет назад +9

    First of All thanks for the nice video. Linear & Quadratic Probing calculations are very clear. I am not clear on the Double hashing formulae application.

  • @hdm_vision
    @hdm_vision 6 лет назад +4

    I see this "This video is contributed by Illuminati." in description box. What does it mean?

  • @vaibhavilohani3421
    @vaibhavilohani3421 4 года назад +5

    I would appreciate if you could define what hash2 function is.

    • @prabhnoorsingh5713
      @prabhnoorsingh5713 3 года назад

      hash function2(x) is just like hash(x) ,2 only represents that it is second function

  • @msgayathridevi3801
    @msgayathridevi3801 4 года назад +2

    Sir what does cache performance mean over here?

  •  6 лет назад +3

    so is this o(n) in the worst case?

  • @MuhammadSoroya
    @MuhammadSoroya 7 лет назад

    I am very confused @8:40
    64Mod11 is 9, not zero. why did you assign 62 to 0th index?

    • @GeeksforGeeksVideos
      @GeeksforGeeksVideos  7 лет назад +1

      In case of (62 mod 11), the result is 7 which is already occupied. So, we go for ((62 + 1*1) mod 11) which gives us 8, again occupied. Next we go for ((62 + 2*2) mod 11) which gives us (66 mod 11) which is 0. So, we insert at 0th index.
      Hope this solves your confusion. :)

    • @deepthi1016
      @deepthi1016 5 лет назад

      @@GeeksforGeeksVideos In case of (62 mod 11), the result is 7 which is already occupied. So, we go for ((7+ 1*1) mod 11) which gives us 3. we should use h0 index for computing h1(x) we don't use the number itself. The formula is correct Hash(key) + i) % size but your example problem is wrong

  • @rabtiranjan4402
    @rabtiranjan4402 5 лет назад +4

    what do you mean by cache performance

    • @mrbobcat7399
      @mrbobcat7399 4 года назад +2

      The linear probing distributes data in the hash table more uniformly, which increases the cache hit probability. For eg. in video 7, 18 and 62 were placed uniformly one after another using linear probing, but in quadratic probing 62 was placed very randomly way above at the first slot. This randomness decreases the cache hit probability. If you don't know about the cache hit probability, you can find about it on the internet.

    • @shortvines9084
      @shortvines9084 4 года назад

      @@mrbobcat7399 COA 😎

  • @harshchaudhary7334
    @harshchaudhary7334 6 лет назад +2

    why poor cache performance in case of double hashing

  • @RajPatel-fe9jw
    @RajPatel-fe9jw 7 лет назад +3

    It is better you learn concept but also try to implement this concept by also coding than it gives more batter idea about the topic for programmer.

    • @GeeksforGeeksVideos
      @GeeksforGeeksVideos  7 лет назад +2

      That is true.
      You can try practice problems related to Hashing here:
      practice.geeksforgeeks.org/tag-page.php?tag=hashing

  • @bridgerhackworth8761
    @bridgerhackworth8761 Год назад

    so is lookup time O(n) if the value is not in the table? It just keeps incrementing i until reaching the end of the table?

  • @raghupathipola4903
    @raghupathipola4903 4 года назад +1

    for quadratic probing
    the equation you written is
    h(x)=(hash(x)+i^2)%hash table size
    but in the explanation you written
    1^1 and 2^2
    please clarify my doubt

  • @mahimajangra3248
    @mahimajangra3248 4 года назад +2

    Sir, How cache performance is determined here ?

    • @mrbobcat7399
      @mrbobcat7399 4 года назад +1

      I am copy-pasting my reply from above but the answer is the same. The linear probing distributes data in the hash table more uniformly, which increases the cache hit probability. For eg. in video 7, 18 and 62 were placed uniformly one after another using linear probing, but in quadratic probing 62 was placed very randomly way above at the first slot. This randomness decreases the cache hit probability. If you don't know about the cache hit probability, you can find about it on the internet.

  • @shrutiagarwal6401
    @shrutiagarwal6401 6 лет назад

    Sir your communication is really very nice, your acsent along with your explanation makes things crystal clear..

  • @mahimajangra3248
    @mahimajangra3248 4 года назад +1

    Sir ,How time complexity came out to be this expression???

  • @sayanjitb
    @sayanjitb 3 года назад

    What does it mean by "Best cache performance"? Can anyone please help!

  • @darcash1738
    @darcash1738 Год назад

    What kind of hashing do python dicts use?

  • @64standardtrickyness
    @64standardtrickyness 3 года назад

    What does best cache performance mean?

  • @satishponnada2387
    @satishponnada2387 6 лет назад

    Can you please explain the case when you know the size of elements that will be inserted ??

  • @zuherabud744
    @zuherabud744 6 лет назад +1

    why did you choose 11 slots for your hash table?

  • @girjashankar7925
    @girjashankar7925 4 года назад

    in open hashing you explained how we allot same index value by linked list,but i want to know that at searching time,how will itgive us exact key @t ,we will simply pass our key to get the value during searching,and that hash function will convert it into a index which having lots of value in form of linked list because of collision,then how will it know the particular value of our key? how will it know there that which value of same index is value of the our key? please do answer

  • @BrijeshPatel-cd4yd
    @BrijeshPatel-cd4yd 7 лет назад

    Is their any change in the internal implementation of map as par jdk8

  • @psindhu6438
    @psindhu6438 4 года назад

    Sir., If we insert an element 29.. After the deletion of element 18...in linear probing... Will it add at position 8 Or at position 10?

  • @prankursaha5290
    @prankursaha5290 7 лет назад +11

    hello Sir,
    it was pretty tough for me to understand the complexity part towards the end of the video
    could be please explain it in some more details
    thank you!

    • @saurabhbaranwal5031
      @saurabhbaranwal5031 5 лет назад +35

      Think of it this way.
      n/m gives you probability of finding an occupied slot in the table. So 1-(n/m) gives you the probability of finding an empty slot in the table.
      Now both insert, find or delete operation require searching for an empty slot at the end. So, how frequently, on average, is our empty slot occuring? Answer is 1-n/m. Now this is the frequency.
      For calculating time, you need to do the reciprocal of the frequency. Hence that gives the result.

    • @pokerfaced8139
      @pokerfaced8139 4 года назад +1

      @@saurabhbaranwal5031 thanks bro it helped

    • @akshitachander1
      @akshitachander1 4 года назад +1

      @@saurabhbaranwal5031 thank you so much man

    • @saurabhbaranwal5031
      @saurabhbaranwal5031 4 года назад +1

      @@akshitachander1 welcome ♥️♥️♥️♥️

    • @VinaySingh-ox7bl
      @VinaySingh-ox7bl 3 года назад

      @@saurabhbaranwal5031 thanks bro

  • @huyvole9724
    @huyvole9724 6 лет назад

    If we have any circle and how would we insert?

  • @TheVendetta43
    @TheVendetta43 7 лет назад +1

    excellent series, thank you. But i have 1 question if i have 10 elements to be placed in 10 slots, complexity is infinite? Can you elaborate on the ending part where alpha=n/m?

  • @NagechaO
    @NagechaO 5 лет назад +1

    what will be if numbers more than size of table ?!

    • @wajidmukhtar63
      @wajidmukhtar63 4 года назад

      Table size can be changed as it is user defined

  • @mahimajangra3248
    @mahimajangra3248 4 года назад

    Isn't the avg time complexity o(1) for hashing ? As told in previous video .

  • @harshitagarwal2135
    @harshitagarwal2135 4 года назад

    Explain time complexity of Open Probing ....HOW is it [1/(1-a)] ??

  • @rishikakapoor6220
    @rishikakapoor6220 4 года назад

    explain the delete operation

  • @BrijeshPatel-cd4yd
    @BrijeshPatel-cd4yd 7 лет назад

    If we are working with hashmap which hashing techniques are used. And why.

    • @GeeksforGeeksVideos
      @GeeksforGeeksVideos  7 лет назад

      Please see this article: www.geeksforgeeks.org/internal-working-of-hashmap-java/
      Hope this helps :)

  • @ganeshv02
    @ganeshv02 2 года назад

    Content is good but the volume is too low even while using a headphones. This definitely needs improvement.

  • @ianpan0102
    @ianpan0102 5 лет назад +1

    Could someone explain why *1/(1-a)* ?

    • @saurabhbaranwal5031
      @saurabhbaranwal5031 5 лет назад +1

      Think of it this way.
      n/m gives you probability of finding an occupied slot in the table. So 1-(n/m) gives you the probability of finding an empty slot in the table.
      Now both insert, find or delete operation require searching for an empty slot at the end. So, how frequently, on average, is our empty slot occuring? Answer is 1-n/m. Now this is the frequency.
      For calculating time, you need to do the reciprocal of the frequency. Hence that gives the result.

    • @harshitagarwal2135
      @harshitagarwal2135 4 года назад +1

      @@saurabhbaranwal5031 Thanks Brother for the explanation , Well done

  • @منارالقحطاني-ظ3ط

    Thank you so much 🙏🙏

  • @amritagrawal6681
    @amritagrawal6681 4 года назад

    Nice Explanation

  • @zaidkidwai7831
    @zaidkidwai7831 3 года назад

    Great video! Thank you

  • @ahmedelsabagh6990
    @ahmedelsabagh6990 5 лет назад

    Great explanation

  • @siddharathghai3791
    @siddharathghai3791 7 лет назад

    Sir how can we calculate successful and unsuccessful search??

  • @karan_93
    @karan_93 4 года назад

    I'm a little bit confused...do I have to calculate the modulus two times i.e. First - while calculating the Hash(X) and then secondly when the '%' is encountered. Is that correct?

  • @sumitkumar-nm9fw
    @sumitkumar-nm9fw 3 года назад

    please also provide codeing examples for better understand

  • @ashwinichandrachar
    @ashwinichandrachar 7 лет назад

    Its good video. the concepts were easily understud ,....but I have one issue that ,there is requirement of English subscription..as we can't see the images/screen completely...

    • @GeeksforGeeksVideos
      @GeeksforGeeksVideos  7 лет назад

      What do you mean English subscription? Do you mean subtitles? We have subtitles with this video. You can turn subtitles on by clicking on the CC (Closed Captions) button. It's on the left of Settings button at the bottom right corner.
      What images/screen can you not see completely? Could you please share the timestamp where you are facing these issues?

  • @sandeepr5007
    @sandeepr5007 7 лет назад +1

    Please provide an example for double hashing

  • @jaatharsh
    @jaatharsh 7 лет назад +1

    NICELY Explained with good ex

  • @chocolateandmath497
    @chocolateandmath497 5 лет назад +2

    1.75x !

  • @yashgupta-dw7sn
    @yashgupta-dw7sn 6 лет назад

    sir can you please explain ..how you decide the size of hash table

  • @shubhamverma1407
    @shubhamverma1407 4 года назад

    I wish youtube had "3x speed"

  • @sachinwalunjakar8854
    @sachinwalunjakar8854 4 года назад

    Thanks for this video.

  • @monicainapakolla7148
    @monicainapakolla7148 4 года назад

    what if h2=h0

  • @maayan6568
    @maayan6568 8 лет назад

    Hi :)
    How \ Do we need to know which h1\h2 etx we used? how do we keep track
    or this detail doesnt matter once we place the value in its place?
    Thanks !

    • @GeeksforGeeksVideos
      @GeeksforGeeksVideos  8 лет назад

      No, we do not need to know which h1/h2/h3 etc we used. This detail does not matter.
      Once we put it there, we can always find it back using the same logic. When we are searching, we keep on probing until the value we are searching matches the value that is stored. If the value is in the table, we will surely find it. If it's not in the table, we will end up reaching an empty slot.

    • @maayan6568
      @maayan6568 8 лет назад

      Thanks mates ! :)

    • @GeeksforGeeksVideos
      @GeeksforGeeksVideos  8 лет назад

      You're welcome, Maayan!

  • @vandananayak9426
    @vandananayak9426 2 года назад

    Thank you sir.

  • @utkarshankit
    @utkarshankit 5 лет назад

    am i the only one who thinks his voice is very low?

  • @dilpreetsingh95
    @dilpreetsingh95 5 лет назад

    Videos are amazing, but I had to watch them at 1.75x speed.

  • @afafnoor775
    @afafnoor775 5 лет назад

    To good sir but I am confuse in double hashing😕

  • @milindmahire8640
    @milindmahire8640 5 лет назад

    Excellent best teach thx

  • @yashnistane6728
    @yashnistane6728 4 года назад

    the volume was too low

  • @piyusharmaus
    @piyusharmaus 6 лет назад

    nice explanation.

  • @vikasvenkatraman2645
    @vikasvenkatraman2645 7 лет назад

    nice video on hashing :)

  • @mysteriousboi1019
    @mysteriousboi1019 4 года назад

    Great video thx!

  • @sukanthenss914
    @sukanthenss914 4 года назад

    More than teaching amazing concepts, it is better to make it audible to viewers. Audio important buddy

  • @bicboi46
    @bicboi46 5 лет назад

    Use 1.5 speed

  • @mohitraj1995
    @mohitraj1995 2 года назад

    sandeep jain sir ka copy kr rhe

  • @do_not_reply4784
    @do_not_reply4784 6 лет назад +2

    thnxx for confusing

  • @cihankara5545
    @cihankara5545 2 года назад

    I did not understand ):

  • @andineziri9628
    @andineziri9628 2 года назад

    Thanks! : D

  • @beatsci-fi
    @beatsci-fi 7 лет назад

    His English is cool

  • @sanjanaattanayake4231
    @sanjanaattanayake4231 Год назад

    ❤❤

  • @Saad-qh4qy
    @Saad-qh4qy 27 дней назад

    FIX YOUR SPEAKING ACCENT PLEASE