Java Hash Table

[ad_1]
Get the Code Here:

Welcome to my Java Hash Table tutorial. A Hash Table is a data structure offers fast insertion and searching capabilities. The negative is that they are limited in size because they are based on arrays. They are also hard to order.

People get confused about them because of the Hash Function. A hash function is used to generate a unique key for every item in the array. Since every item is entered using a calculation, this allows you to reverse the calculation to immediately find the proper index. This way you can find items without the need to search through the whole array.


Posted

in

by

Tags:

Comments

37 responses to “Java Hash Table”

  1. Joseph Fernando Avatar

    at 2:12…how does it go directly to that location …what is the science behind that…doesnt it have to search that hash value in the array one by one…??

  2. surya DK Avatar

    And love your videos..

  3. surya DK Avatar

    you are teaching some what fast which is difficult to understand someone…

  4. Yifan Gong Avatar

    Very Clear, set to 0.75X speed for 5 second then decide to go with normal speed…

  5. Rushi Desai Avatar

    Your displayStack function blew me away! Respect.

  6. Vishal Sharma Avatar

    arrays.fill() whats that??? not mentioned before..

  7. divya jain Avatar

    Hey derek, great tutorial.Simple yet elegant
    I just found a simple mistake in your code in findKey, if a key is not found the loop will run for infinite time. so just need to add below in findKey
    int count = 0;
    while(count < theArray.length && theArray[arrayIndexHash] != "-1"){
    count ++ ;
    …REST SAME…..
    Thanks. 🙂

  8. Rishi Mehta Avatar

    I tried inserting a comment saying "key not found!" at before returning null in the findkey() method, but it wont display, and Im having a hard time thinking why not.

  9. Saboor Hamedi Avatar

    why you skip the video if you dont like dont make tutorial

  10. Muhtasim Ahmed Avatar

    Can you show the display method ?

  11. Benjamin Henry Avatar

    I have to agree with the comments about not slowing down. And I'm one of the ones that has to pause and rewind. But I do when I need to. You have always been extremely thorough. It's not like you leave things out. You're one of the very best out there. Probably top 1%.

  12. darkziik Avatar

    Hey man you're a fucking beast of code, thanks for teaching!

  13. Anthony Awuzie Avatar

    there is a java class for hash table lets say I go for an interview, should I use the class or hand code it the way you just did?

  14. Evan Metcalfe Avatar

    Brilliant video, was very clear and very informative.

  15. Elec Tra Avatar

    What the difference between making your own hash table and using the java class one?
    Hashtable<Integer,String> myTable= new Hashtable<Integer,String>();

  16. Arun Sundaramoorthy Avatar

    @Derek — First Off, I started listening to your Java Algorithm tutorial. I was quite impressed because is crisp and simple. So kept on listening to other tutorials. Keep doing it.

  17. chirag soni Avatar

    how HashTable is based on array…..?

  18. Moein Pardakhtim Avatar

    great video however there is a small bug in your code, if you are interested in knowing what it is. ask me

  19. heath bm Avatar

    Your search function will never work if your table is full. Because there will be no -1 value to cause the loop to stop.

  20. Hà Vĩnh Phú Avatar

    Thanks, man.Your tut get direct to the point. I love that.

  21. Javier Guerrero Avatar

    These tutorial videos are only good as refresher or to practice already being exposed to Hash tables. If this is the first time being exposed to hash tables and you comment "omg thank you so much I understood everything" than you are pseudo learning.

  22. 420metal Avatar

    Wonderful video, much more informative than my lectures at University. Thank you.

  23. f. f. white Avatar

    Should not the findKey function be passed a value the caller wants to find, for which a key must be calculated?

  24. Ben Van Avatar

    The content is great, but ur teaching style was terrible. It's not teaching, it's just reading fast like u're in a race 😀

  25. Ben Van Avatar

    The content is great, but ur teaching style was terrible. It's not teaching, it's just reading fast like u're in a race 😀

  26. Ben Van Avatar

    The content is great, but ur teaching style was terrible. It's not teaching, it's reading fast

  27. Ben Van Avatar

    The content is great, but ur teaching style was terrible. It's not teaching, it's reading fast

  28. Ben Van Avatar

    The content is great, but ur teaching style was terrible. It's not teaching, it's reading fast

  29. Michael Cera Avatar

    is this using bucket arrays?

  30. Standoffproductions Avatar

    This guy is a freaking boss at explaining hash tables and hash functions. Unfortunately I found it towards the end of the semester for my data structures class but I will be using these videos in the future. Thanks a lot dude!

  31. Aquib Javed Avatar

    That little guy at 1:54 looks quite a lot like the president elect xD

  32. Eloy Maduro Avatar

    Great vid! but please, less whitespace xd

  33. Wisdom Manaka Avatar

    for the first segment of the implementation my codes output doesn't want to show

Leave a Reply

Your email address will not be published. Required fields are marked *