Hashing Table and Binary Tree


Hashing

Hashing is a technique used for storing and retrieving keys in a rapid manner. The string of characters is made shorter in length value but still represents its original string.

Hash Table

Hash table is a table of array where a string is stored and can be hashed. Its size is usually smaller that the total number of possible string, so several string might have a same hashed-key.

Hash Function

There are a lot of ways to hash a string into a key, the most common is Division.

Division

Division is one of the methods used to hash a string into a key, which is done by dividing the string/identifier by using the modulus operator and the value that is usually used is a prime number, the table size or the size of memory used.

“HIKE” would be stored at the location
                        ( 64+8 + 64+9 + 64+11 + 64+5) % 97 = 2

Binary Tree
Binary tree is rooted tree data structure in which each node has at most two children and the two children usually distinguish themselves as left child and right child. The node that doesn’t have any child is called leaf.
Types of binary tree
-        Perfect Binary Tree
            It is a binary tree which every level are at the same depth
-        Complete Binary Tree
It is a binary tree in which every level except the last is completely filled and all    nodes are as far left as possible. A perfect binary tree is a complete binary tree
-        Skewed Binary Tree
It is a binary tree in which each node has at most one child
-        Balanced Binary Tree
It is a binary tree in which no leaf is much farther away from the root than any other leaf.

The Research

A hash is a function that converts an input of letters and numbers into an encrypted output of a fixed length. A hash is created using an algorithm and is essential to blockchain management in cryptocurrency. It helps in storing data of transaction (Time, Date, Who etc.). The blockchain technology is probably one of the most defining technological innovations of our time. It has changed the ways how digital transactions are managed and arranged. Hashing in blockchain refers to the process of having an input of whatever length reflecting an output item of a fixed length. Example : When you take video of 100 megabytes and hash it using SHA-256 the output will be a hash of 256-bits in length and if you take a video of 50 megabytes the output will be the same. The difference will lie on the hash pattern


Comments

Popular posts from this blog

AVL Tree and B-Tree

Stack and Infix, Prefix, Postfix Notation

Linked List II Summary