Hash Table and Binary Tree
HASH TABLE
Hash Table is a data structure that stores data. It is consist of 2 parts:
- An array format (generally array of Linked List) where we keep the data with special index value.
- A hash function that help us to decide wherein the inputted data could be saved.
Access of data will be very fast if we know the index of the wanted data. The efficiency of mapping itself relies upon on how fast the hash function is.
Hashing is implemented in 2 steps:
- An element is converted into an integer by the usage of a hash function. This element may be used as an index to keep the original, which falls into the hash table.
- The element is stored in the hash table where it may be fast retrieved by the use of hashed key.
Cryptographic Hash Functions
A cryptographic hash function is a unique class of hash functions that has numerous properties making it ideal for cryptography. There are certain properties that a cryptographic hash function needs to have in order to be taken into consideration secure.
The blockchain is a linked list that contains records and a hash pointer that factors to its previous block, therefore developing the chain.
If a hacker attacks and attempts to change the facts. Because of the properties of hash functions, a moderate alternate in data will exchange the hash drastically that will absolutely trade the chain, which is impossible.
BINARY TREE
A binary tree is made of nodes, where every node includes a left reference, a right reference and a data element.
- Root − The topmost node
- Parent − Each node (aside from the root) is linked through an edge from another node(upward)
- Child − Related to other node when getting away from the root(downward)
- Leaf − Node without children
InOrder traversal
- first go to the left child then the parent and the right child
- gives nodes in non-decreasing order
PreOrder traversal
- first go to the parent then the left and the right children
- create a duplicate of the tree
- get prefix expression
- first go to the left child then the right child and then the parent
- delete the tree
- get the postfix expression
code :
https://www.hackerearth.com/practice/data-structures/hash-tables/basics-of-hash-tables/tutorial/
https://www.geeksforgeeks.org/hashing-data-structure/
https://www.tutorialspoint.com/data_structures_algorithms/hash_data_structure.htm
Comments
Post a Comment