what is hashtable in java
introduction hashtable in java:
In this Tutorial Today Learn HashTable in java programming well hello internet and welcome to tutorial today we're going to talk about Java hash tables and more specifically I'm going to spend a lot of time on hash function s and how they work I'm going to present them in numerous different ways and show you numerous different code examples to make sure you 100% understand this so let's get into it so what exactly is a hash table a hash table is just a data structure like anything else in this tutorial it's probably better to think of it as an array because I'm going to go through this really slowly and completely build up from the base what it does is it offers very fast both insertion as well as searching however they're limited in size because of like I said before it's based off of an array it can however be resized but of course that is to be avoided and they are very hard to order so how to hash tables and hash functions work together well key values are going to be assigned to elements in a hash table just think array using a hash function and what a hash function helps you do is calculate.
hashtable in java for the best index an item should go in now of course the index must be small enough so that it stays within the constraints of the array size but also it can't overwrite other data in the hash table a hash functions basic job is to store values in an array with a limited size and it does it in a way that the array doesn't need to be searched through whenever the user decides to go and try to find that information in the hash table so this allows you to enter values in any order and be able to find them using a calculation instead of searching through the array and that is why they are very fast so basically if you have your little guy here and he wants information that was stored in a hash table and he has a very specific non duplicate ID for that information that ID is going to go through a calculation and that calculation is going to provide the exact index for that information then it goes directly to that location in the array or the hash-table and sends the in formation back to the user that is in essence what a hash function and how a hash table functions so let's go and look at some code and of course all of the code.
in this video is available to link underneath the video so and of course it's free and you should get it because it is very heavily commented all right so we're gonna create our array because that's in essence what we're dealing with here also gonna monitor array size and even though I don't think I'm going to use it in this part of the tutorial I'm also going to store the items in our array then I'm going to create my constructor for this and I just called this hash function because that's really what we're gonna be focusing on and it's we're going to receive a size for our array and then we are going to store that array size of course and we are also going to create our array with that specific size in java programming for hashtable in java.
No comments:
Post a Comment