NO. | questions |
---|---|
type of questions | |
1 | What-is Hash Table |
2 | How-is-hash-table-implemented |
3 | Types-of-hash-table |
4 | Advantage-of-hash-table |
5 | Hash-table-usage |
| 1. | What-is Hash Table
HASH TABLE and it usages familiar to Arrays
| 2. |How-is-hash-table-implemented
suppose if we assume HT[TOYOTA]= 20 HT[TESLA]= 40 are the values
suppose, give a value to HASH("TOTOTA") =>3 is the value , means SIZE of the array
|0 | 1 | 2| 3 | 4 | 5 | 6 | 7 | 8 | => is the size of the HASH table and HASH("TOYOTA")=> 3, HASH("TESLA") => 5, are the size of the Hash
HASH table converts string into number
we declare values to 'HASH" by HT[TOTOTA]= 20 => | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
NOW HASH("TOYOTA") =>3 value HT[TOYOTA]= 20 | - | - | 20 | - | - | - | - | - | - |
Now HASH("TESLA") =>5 value HT[ TESLA]= 40 | - | - | - | - | - | 40| - | - | - |
Has table have its determestick nature, far a give field it will always gives the same output
Now HASH ("MARUTHI")= 5 MULTIBLE VALUES AT SAME FIELD IS CALLED COLLISION TECHNICS
what will happen the value is 78 which is not in hash table then we will take 'MODULO" VALUE is called 78 % 9 => 6 is the remender value
n % m <_ m-1 which tells about Modula formula 'M' modula size of the HASH= [] TABLE
Better to AVIOD collisuion
HASH ("toyato") => 78 % 9 => 6
is called collisionHASH ("Tesla") => 51 % 9 => 6
Incase of collision, we need to apply collision resolvation technics
HASH table converts string into number
we declare values to 'HASH" by HT[TOTOTA]= 20 => | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
NOW HASH("TOYOTA") =>3 value HT[TOYOTA]= 20 => | - | - | 20 | - | - | - | - | - | - |
Now HASH("TESLA") =>5 value HT[ TESLA]= 40 => | - | - | - | - | - | 40| - | - | - |
| 3 |Types-of-hash-table
There are two types of HASH tables, they are