Posts

Review

Data Structures means of organizing and storing data in computers so that we can perform operations on stored data more efficiently. Common example of data structures : 1.      Array                : Structure which hold items of the same data 2.      Linked list       : Structure that link items in linear order 3.      Stacks              : Structure that do Last In First Out to it’s element 4.      Queues                         : Structure that do First In First Out to it’s element 5.      Hash Tables     : Structure that stores value with its key 6.      Binary Trees ...

Hashing & Binary Tree

Image
Hashing Hashing is an important Data Structure which is designed to use a special function called the Hash function which is used to map a given value with a particular key for faster access of elements. The efficiency of mapping depends of the efficiency of the hash function used. Hash Table An array that stores pointers to records corresponding to a given phone number. An entry in hash table is NIL if no existing phone number has hash function value equal to the index for the entry. Hash Function A function that converts a given big phone number to a small practical integer value. The mapped integer value is used as an index in hash table. In simple terms, a hash function maps a big number or string to a small integer that can be used as index in hash table. Collision Since a hash function gets us a small number for a key which is a big integer or string, there is a possibility that two keys result in the same value. The situation where a newly inserted key maps to an alrea...