Skip to content

sudheerkodali/HASH-TABLE-DSA

Repository files navigation

HASH TABLE DSA

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

1. Hash table

HASH TABLE and it usages familiar to Arrays

what-is-hash-table

1.1 Hash table

what-is-hash-table

| 2. |How-is-hash-table-implemented

2.1 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 collision

HASH ("Tesla") => 51 % 9 => 6

Incase of collision, we need to apply collision resolvation technics

what-is-hash-table-implemented

2.2 Hash table values and size

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| - | - | - |

what-is-hash-table-implemented

2.3

what-is-hash-table-implemented

2.4

what-is-hash-table-implemented

| 3 |Types-of-hash-table

3.1 Types of HASH tables

There are two types of HASH tables, they are

Types-of-HASH-tables

3.2 Types of HASH tables

Types-of-HASH-tables