JavaScript Data Structures - 30 - Hash Table Collisions

แชร์
ฝัง
  • เผยแพร่เมื่อ 31 ธ.ค. 2024

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

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

    Thank you sir, the explanation is very easy to understand for me who is still a beginner in learning English 🙏

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

    Hello sir you are really doing a good job as a programmer DSA is very much important thanks for your efforts sir keep it up 👍

  • @AhmedMohammed-ks8uo
    @AhmedMohammed-ks8uo 2 ปีที่แล้ว

    Thank you for this pretty course, you are the best instructor, keep going

  • @travelwithme99-0
    @travelwithme99-0 ปีที่แล้ว +1

    I believe we could have used two dimentional array from the start, and filter/find using key by matching to x-axis, why do we have to use hash if there is a chance for collision which then will be resolved with two dim array.

  • @sarathdev9018
    @sarathdev9018 ปีที่แล้ว +9

    brototypians please like!!

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

    How is making changes in the "samKeyItem" in the set function allowing us to change this.table[index]

  • @basharal-zghayar4564
    @basharal-zghayar4564 ปีที่แล้ว +1

    I have a silly question, why we do not use an object to save the values?
    like hashObject = {}
    hashObject[key] = value
    let retrievedValue= hashObject[key]

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

    Thank you!

  • @amal-uz1cj
    @amal-uz1cj 9 หลายเดือนก่อน

    Which collision avoidance method did you use here?
    I have heard some ways like linear probing and chaining, so which one have you used here? please reply i am confused

  • @tensorbaba7687
    @tensorbaba7687 8 หลายเดือนก่อน

    how is average time complexity constant? since we are using .find..souldnt that be linear O(n)

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

    Vishwas, what about time complexity of splice() as it modifies the existing array...

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

    bucket.push([key, value])
    And then
    this.table[index] = bucket;
    Else overriding the keys will not work as expected.

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

      it's prevent collision when the keys have the same hash result , but when set a new value with the same key it's override.

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

    Could have used array filter() in the remove() instead of using find() and splice().

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

      Google returned such info:
      The main advantage of using find() in those cases is that find returns as soon as a match is found, but filter would run through the entire array even if a match is found in the 1 st index position and you don't want to do that for large arrays when all you are concerned about is one match!

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

    hi codevolution you're doing a great job 👍 thank you very much.... tell me do you have React native courses on the channel?

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

      We are looking for React Native Is it hard i know react js very good
      but i culdnt arrrange time to start React native yet

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

    hash(key) {
    let total = 0
    for (let i = 0; i < key.length; i++) {
    total += key.charCode(i) + i
    }
    return total ℅ this.size
    }
    Maybe this is enough for handling the collision

    • @travelwithme99-0
      @travelwithme99-0 ปีที่แล้ว

      good thought, there is still chance of collision due to total char sum (even with adding index) in one word can match other word.

    • @oliayuras7257
      @oliayuras7257 2 หลายเดือนก่อน

      @@travelwithme99-0 if you are calculating total it does not matter in which order you will add 1+..+2+..+3+..+4

  • @ShubhamPatil-rr4on
    @ShubhamPatil-rr4on 2 ปีที่แล้ว

    Hey are you from Maharashtra, India
    Really..?