Hashing
Hashing is a technique used for storing and retrieving keys in a quicker option. A hash is a value computed from a base input number using a hashing function. In hashing, a string of characters is transformed into a usually shorter length value or key that represents the original string. Hashing is used to index and retrieve items in a database because it is faster to find an item using shorter hashed keys than to find it using the original value.
Binary Trees are used as a means of accessing nodes based on some value associated with each other's node. Binary trees labeled this way are used to implement binary search trees and binary heaps and are used for efficient searching and sorting. The designation of non-root nodes as a left or right branch even when there are only one branch present matters in some of these applications, in particular, it is significant in binary search trees. However, the arrangement of particular nodes into the tree is not part of the needed information
Hashing is a technique used for storing and retrieving keys in a quicker option. A hash is a value computed from a base input number using a hashing function. In hashing, a string of characters is transformed into a usually shorter length value or key that represents the original string. Hashing is used to index and retrieve items in a database because it is faster to find an item using shorter hashed keys than to find it using the original value.
Hash Table
Hash table is an array where it stores the original string. The index of the table is the hashed key while the value is the original string. The size of the hash table is usually several orders of magnitude lower than the total number of possible string, so several strings might have the same hashed-keys.
Example:
Supposed we want to store 5 string: Apple, Fish, Banana, Dog, Chair into a hash table with size 26. The hash function we are gonna use is “transform the first letter of
each string into a number between 0 to 25”
(a will be 0, b will be 1, c will be 2, …, z will be 25).
h[ ]
|
Value
|
0
|
Apple
|
1
|
Banana
|
2
|
Chair
|
3
|
Dog
|
4
| |
5
|
Fish
|
Binary Tree
A tree whose elements have at most 2 branches is called a binary tree. Since each element in a binary tree can have only 2 branches it is divided as the left and the right.

A Binary Tree node contains the following parts:
- Data
- Pointer to the left branch
- Pointer to the right branch
BinaryTrees: Unlike Arrays, Linked Lists, Stack and queues, which are linear data structures, binary trees are hierarchical data structures. Which means the data are organized into a tree-like structure.
Binary Trees are used as a means of accessing nodes based on some value associated with each other's node. Binary trees labeled this way are used to implement binary search trees and binary heaps and are used for efficient searching and sorting. The designation of non-root nodes as a left or right branch even when there are only one branch present matters in some of these applications, in particular, it is significant in binary search trees. However, the arrangement of particular nodes into the tree is not part of the needed information
Comments
Post a Comment