0% found this document useful (0 votes)
6 views56 pages

Hashing

The document provides an overview of hashing, a technique used in data structures for efficient data storage and retrieval using hash functions. It discusses the structure and operations of hash tables, their advantages and disadvantages, collision resolution strategies, and various types of hash functions. Additionally, it covers concepts like load factor, rehashing, and applications of hash tables in different programming contexts.

Uploaded by

harshadsamrut3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views56 pages

Hashing

The document provides an overview of hashing, a technique used in data structures for efficient data storage and retrieval using hash functions. It discusses the structure and operations of hash tables, their advantages and disadvantages, collision resolution strategies, and various types of hash functions. Additionally, it covers concepts like load factor, rehashing, and applications of hash tables in different programming contexts.

Uploaded by

harshadsamrut3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 56

UNIT-I

HASHING
HASHING
Hashing is a technique used in data structures that efficiently stores and retrieves data in a way that
allows for quick access.
Hashing is finding an address where the data is to be stored as well as located using a key with the
help of the algorithmic function called as hash function.
A hash table is an array-based structure used to store <key, information> pairs. A hash table is a
data structure that stores records in an array, called a hash table.
A Hash table can be used for quick insertion and searching.
The resulting address is used as the basis for storing and retrieving records and this address is called
as home address of the record
For array to store a record in a hash table, hash function is applied to the key of the record
being stored, returning an index within the range of the hash table
The item is then stored in the table of that index position
For storing record:
Key generate array index store the records on that array index

For accessing the Record:


Key Generate array index get the record.

The generation of array index uses hash function which conerts the keys into
array index
Key hash function Array index
Hash Table
Hash table is one of the most important data structures that
uses a special function known as a hash function that maps a
given value with a key to access the elements faster.
A Hash table is a data structure that stores some information,
and the information has basically two main components, i.e.,
key and value.
For example, suppose the key value is John and the value is
the phone number, so when we pass the key value in the hash
function shown as below:
Hash(key)= index;
When we pass the key in the hash function, then it gives the
index.
Hash(john) = 3;
The above example adds the john at the index 3.
ADVANTAGES OF HASH TABLE:
Hash provides better synchronization than other data structures.
Hash tables are more efficient than search trees or other data structures.
Hash tables have high performance when looking up data, inserting, and
deleting existing values.
Hash provides constant time for searching, insertion and deletion
operations on average.
Hash tables are space-efficient.
The time complexity for hash tables is constant regardless of the
number of items in the table.
Most Hash table implementation can automatically resize itself.
Hash tables are easy to use. They perform very well even when
working with large datasets.
Hash tables offer a high-speed data retrieval and manipulation.
DISADVANTAGES OF HASH TABLE:
Hash is inefficient when there are many collisions.
Hash collisions are practically not be avoided for large set of
possible keys.
Hash does not allow null values.
Hash tables have a limited capacity and will eventually fill
up.
Hash tables can be complex to implement.
Hash tables do not maintain the order of elements, which
makes it difficult to retrieve elements in a specific order.
OPERATIONS OF HASHTABLE
The three primary operations of a hash table are search,
insert, and delete.
Insertion – this Operation is used to add an element to the
hash table
Searching – this Operation is used to search for elements

in the hash table using the key

Deleting – this Operation is used to delete elements from

the hash table


APPLICATIONS OF HASH TABLE
Hash is used in databases for indexing.
Hash is used in disk based data structures.
In some programming languages like Python,
JavaScript hash is used to implement objects.
Hash tables are commonly used to implement caching
systems
Used in various cryptographic algorithms.
Hash tables are used to implement various data
structures.
Hash tables are used in load balancing algorithms
PROPERTIES OF HASH FUNCTION
Hash function should be simple to computer.

Number of collision should be less

The hash function uses all the input data.

The hash function "uniformly" distributes the data


across the entire set of possible hash values.

The hash function generates very different hash values for


similar strings.
BUCKET
In a hash table, buckets are storage units that hold
data items after they have been hashed using a hash
function.
Buckets are used to organize and access data
efficiently, especially when performing lookups
Bucket is an index position in hash table that can store more
than one record.
Whenthe same index is mapped with two keys, then
both the records are stored in the same bucket
COLLISION
When the two different values have the same value, then the
problem occurs between the two values, known as a collision.
The result of two keys hashing into the same addressis
called collision
PROBE, SYNONYMS, OVERFLOW
PROBE:
Each calculation ofan address and test for success is
known as Probe.
Probing in hashing is a technique used to find the correct
position of a key in a hash table.

SYNONYMS:Keys those hash to the same address are


called synonyms

OVERFLOW:The result of more keys hashing to the same


address and if there is no room in the bucket, then it is said
that overflow has occurred.
Collision and overflow are synonymous when the
bucket is of size 1
OPEN HASHING, CLOSED HASHING
•In data structures, open hashing and closed hashing are two different
ways to handle hash collisions:
Open hashing
Stores collisions outside the hash table, usually in a linked list. This
is also known as separate chaining.
When a hash table uses open hashing, each slot in the hash table is
the head of a linked list. This is most appropriate when the hash
table is kept in main memory.
Closed hashing
Stores collisions in another slot within the hash table. This is also
known as open addressing
When a hash table uses closed hashing, all elements are stored
directly in the hash table. This method uses probing techniques to
find space for each key.
Perfect Hash Function
Perfect hashing is a data structure technique that stores records in
a hash table without collisions.
It works by generating a hash function for a set of keys that are
known in advance. This allows for storing \(n\) records in a table
with only \(n\) slots .
perfect hash function h for a set S is a hash function that
maps distinct elements in S to a set of m integers, with
no collision.
LOAD FACTOR
Load factor is defined as (m/n) where n is the total size of the hash
table and m is the preferred number of entries which can be inserted
before a increment in size of the underlying data structure is
required.

If Load factor (α) = constant, then time complexity of Insert,


Search, Delete = Θ(1)
Load factor and Load density
Load Factor: The ratio of the number of items in a
table to the table’s size is called the load factor.
Load Density : The identifier density of a hash table is
the ratio n/T,
where n is the number of identifiers in the table. The
loading density or loading factor of a hash table is a=n
/(sb).
T is total number of possible elements.
EXAMPLE: Consider the hash table with b = 26
buckets and s = 2. We have n = 10 distinct identifiers,
each representing a C library function.
This table has a loading factor, a, of 10/52 = 0.19
REHASHING
Rehashing is the process of increasing the size of a hash map and
redistributing the elements to new buckets based on their new hash
values.
It is done to improve the performance of the hash map and to
prevent collisions caused by a high load factor.
When a hash map becomes full, the load factor (i.e., the ratio of the
number of elements to the number of buckets) increases.
As the load factor increases, the number of collisions also increases,
which can lead to poor performance.
To avoid this, the hash map can be resized and the elements can be
rehashed to new buckets, which decreases the load factor and
reduces the number of collisions.
During rehashing, all elements of the hash map are iterated and their
new bucket positions are calculated using the new hash function that
corresponds to the new size of the hash map.
This process can be time-consuming but it is necessary to maintain
the efficiency of the hash map.
Issues in Hashing
Hash collisions:When two or more inputs produce the same hash
value, this is called a hash collision. This can happen with poorly
designed hash functions, or when there are a large number of
possible keys. To reduce collisions, you can use a good hash function
and a prime number as the table size.
Irreversibility:Hashing is a one-way process, which means it's not
possible to reverse a hash value back to its original input.
Limited capacity:Hash tables have a limited capacity and will
eventually fill up.
Inefficient for range queries:Hash tables are not well-suited for
finding elements within a certain range.
Susceptibility to brute-force attacks:Hashing is vulnerable to
brute-force attacks, especially when the input space is small or
predictable.
Security depends on the hash algorithm:The security of hashing
depends on the strength and security of the underlying hash
algorithm. Insecure hashes can be exploited by attackers to
manipulate the original data.
HASHING / HASH FUNCTION
Hash function is a function when applied to the key which
produces an integer which will be used as an address in a hash
table.
The main idea behind the hashing is to create the (key/value)
pairs. If the key is given, then the algorithm computes the index at
which the value would be stored. It can be written as:
Index = hash(key)
Properties /Characterstics of good hash function
Fast computation:A good hash function should be very fast to compute.

Low collision probability: A good hash function should minimize the duplication of
output values, also known as collisions.

Data integrity: A good hash function should make it difficult for attackers to predict the
output based on known inputs.

Effective searching: A good hash function should minimize the number of comparisons
while performing a search.

Efficient data retrieval: A good hash function should allow for quick access to elements
with constant-time complexity

Collision resolution: A good hash function should have a collision resolution method
that uses an auxiliary data structure or systematic probing of the table.

Cryptographic hash functions: A specialized group of hash functions that provide an


increased level of security
TYPES OF HASH FUNCTION
There are four ways of calculating the hash function:
1. Division method
2. Multiplication method
3. Folding method
4. Mid square method
1.Division method:
This is the most simple and easiest method to generate a hash value. The hash function divides the
value k by M and then uses the remainder obtained.
For creating hash function we map a key k into one of m slots by taking the remainder of k
divide by m
Formula: h(k) = k mod, Here,k is the key value, and M is the size of the hash table .
Example 1: if the keyvalue is k= 100 andthe size of the hash table is m=12. When
we apply the hash function to key 100 then the index would be:
h(k) = 100%12 = 4
The index is 4 at which the value is stored.
Example2: k = 12345, M = 95
h(12345) = 12345 mod 95
= 90 , The index is 90 at which the value is stored.

Example 3: k = 1276 ,M = 11
h(1276) = 1276 mod 11
= 0 , The index is 0 at which the value is stored.
2.Mid square method: is a very good hashing method.
We square the key ,after getting number we take some digits from the middle of
that number as an address.
Square the value of the key k i.e. k2
Extract the middle r digits as the hash value.
Example: let us take 4 digit number as a key
1273 1391 1026
Now take square of these keys
1787569 1620529 1934881 1052676
Now take 3rd and 4th digit fro each number and that will be the address of these keys where the table
size is 1000
75 05 48 26
3.Digit Folding Method : one of the easiest way to compute the keys to break key into pieces,add
them and get the hash address
This method involves two steps:
Divide the key-value k into a number of parts i.e. k1, k2, k3,….,kn, where each part has the same
number of digits except for the last part that can have less digits than the other parts.
Add the individual parts. The hash value is obtained by ignoring the last carry if any.
Example: let us consider 8 digit key as 12345
k = 12345
k1 = 12, k2 = 34, k3 = 5
s = k1 + k2 + k3
= 12 + 34 + 5
= 51
h(K) = 51
4. Multiplication method :This method involves the following steps:
Step 1:multiply the key k by a constant A in the range value A such that 0 < A < 1.
Multiply the key value with A.
Extract the fractional part of kA.(kA mod 1 is the fractional part)

Step 2:Multiply the result of the above step by the size of the hash table i.e. M. and take the floor of
the result.
H(k)=m(kA mod 1)
Formula:
h(K) = floor (M (kA mod 1)) Here, M is the size of the hash table. k is the key value.
A is a constant value.Where "k A mod 1" means the fractional part of k A, that is, k A -⌊k A⌋.
Example:
k = 12345 ,A = 0.357840 ,M = 100
h(12345) = floor[ 100 (12345*0.357840 mod 1)]
= floor[ 100 (4417.5348 mod 1) ]
= floor[ 100 (0.5348) ]
= floor[ 53.48 ]
= 53
Collision Resolution Strategies /Techniques:
In Hashing, hash functions were used to generate hash values. The hash
value is used to create an index for the keys in the hash table.
The hash function may return the same hash value for two or more keys.
When two or more keys have the same hash value, a collision happens.
To handle this collision, we use Collision Resolution Techniques.
Collision Resolution Techniques:
Separate Chaining: : It is also called as Open Hashing.
Open Addressing: It is also called as Closed Hashing.
PROBING
Method Description
Just like the name suggests, this method searches for empty slots
linearly starting from
the position where the collision occurred and moving forward. If
Linear probing
the end of the list is reached and no empty slot is found. The
probing starts at the beginning of the list.
Quadratic
This method uses quadratic polynomial expressions to find the
probing
next available free slot.

Double This technique uses a secondary hash function


algorithm to find the next free available slot.
Hashing
Separate Chaining (open hashing/External hashing)
Advantages:

1) Simple to implement.
2) Hash table never fills up, we can always add more elements to the chain.

3) Less sensitive to the hash function or load factors.


4) It is mostly used when it is unknown how many andhow frequently keys may be

inserted or deleted.

Disadvantages:
1) Cache performance of chaining is not good as keys are stored using a linked list. Open
addressing provides better cache performance as everything is stored in the same table.

2) Wastage of Space (Some Parts of hash table are never used)


3) If the chain becomes long, then search time can become O(n) in the worst case.

4) Uses extra space for links


Collision Resolution Techniques
Using the hash function ‘key mod 7’, insert the following sequence of keys in the hash
table- 50, 700, 76, 85, 92, 73 and 101.
Use separate chaining technique for collision resolution.

Step-01:Draw an empty hash table.

For the given hash function, the


possible range of hash values is [0, 6].
So, draw an empty hash table consisting of 7 buckets as-

Step-02:Insert the given keys in the hash tableone by one.


The first key to be inserted in the hash table = 50.
Bucket of the hash tableto which key 50 maps
= 50 mod 7 = 1.
So, key 50 will beinserted in bucket-1 of the hash table as-
Collision Resolution Techniques
Step 3:The next key to be inserted in the hash table
= 700. Bucket of thehash table to which key 700 maps = 700 mod 7
= 0.
So, key 700 will be inserted in bucket-0 of the hash table as-
Step 4:The next key to be inserted in the hash table = 76.
Bucket of the hash table to which key 76 maps = 76 mod 7 = 6.
So, key 76 will be inserted in bucket-6 of the hash table as-

Step 5: The next key to be inserted in the hash table = 85.


Bucket of the hash table to which key 85 maps = 85 mod 7 = 1.
Since bucket-1 is already occupied,
so collision occurs. Separate chaining handles the collision by creating a
linked list to bucket-1.
So, key 85 will be inserted in bucket-1 of the hash table as-
Collision Resolution Techniques
Step-06 :The next key to be inserted in the hash table = 92.
Bucket of the hash table to which key 92 maps = 92 mod 7 = 1.

Since bucket-1 is already occupied, so collision occurs

. Separate chaining handles the collision by


creating a linked list to bucket-1. So, key 92 will be inserted in bucket-1 of the hash table as-
Step-07 :The next key to be inserted in the hash table = 73.
Bucket of the hash table to which key 73 maps
= 73 mod 7 = 3.So, key 73 will be inserted in bucket-3 of the hash table as-
Step-08 :
The next key to be inserted in the hash table = 101.
Bucket of the hash table to which key 101 maps = 101 mod 7 = 3.

Since bucket-3 is already occupied, so collision occurs.


Separate chaining handles the collision by creating a linked list to bucket-3.
So, key 101 will be inserted in bucket-3 of the hash table as-
Collision Resolution Techniques
Using the hash function ‘key mod 7’, insert the following
sequence of keys in the hash table-
50, 700, 76, 85, 92, 73 and 101.
Use separate chaining technique for collision resolution.
Open Addressing
In open addressing,

1. Unlike separate chaining, all the keys are stored inside the hash
table.

2. No key is stored outside the hash table.

Techniques used for open addressing are-

1. Linear Probing
2. Quadratic Probing
3. Double Hashing
Operations in Open Addressing
1. Insert Operation-
• Hash function is used to compute the hash value for a key to be inserted.

• Hash value is then used as an index to store the key in the hash table.
In case of collision,

• Probing is performed until an empty bucket is found.

• Once an empty bucket is found, the key is inserted.


Probing is performed in accordancewith the technique used for open addressing.
Search Operation-
To search any particular key,
• Its hash value is obtained using the hash function used.

• Using the hash value, that bucket of the hash table is checked.

• If the required key is found, the key is searched.


• Otherwise, the subsequent buckets are checked until the required key or an empty bucket is found.
• The empty bucket indicates that the key is not present in the hash table.
Search Operation-
• The key is first searched and then deleted.

• After deleting the key, thatparticular bucket is markedas “deleted”.


Open Addressing Techniques

Linear Probing-
1. When collision occurs, we linearly probe for the next bucket.
2. We keep probing until an empty bucket is found.
Advantage-It is easy to compute.
Disadvantage-
1.The main problem with linear probing is clustering.
2.Many consecutive elements form groups.
3.Then, it takes time to search an element or to find an empty bucket.
Open Addressing Techniques

1. Linear Probing -
Let us consider a simple hash function as “key mod 7” and a sequence of
keys as 50, 700, 76, 85, 92, 73, 101.
Open Addressing Techniques
2. Quadratic Probing:When collision occurs, we probe for i2‘th bucket in ith iteration.
We keep probing until an empty bucket is found.
3.Double Hashing-
We use another hash function hash2(x) and look for i * hash2(x) bucket in ith
iteration.
It requires more computation time as two hash functions need to be computed.
Double hashing is a collision resolving technique in Open Addressed Hash
tables. Double hashing uses the idea of applying a second hash function to key when
a collision occurs.
Separate chaining vs Open Addressing Techniques

Separate Chaining Open Addressing


Keys are stored inside the hash table as All the keys are stored only inside the hash
well as outside the hash table. table.
The number of keys to be stored in the hash The number of keys to be stored in the hash
table can even exceed the size of the hash table can never exceed the size of the hash
table. table.
Deletion is easier. Deletion is difficult.
Extra space is required for the pointers to
store the keys outside the hash table. No extra space is required.

Cache performance is poor. Cache performance is better.


This is because of linked lists which store This is because here no linked lists are
the keys outside the hash table. used.
Some buckets of the hash table are never Buckets may be used even if no key maps
used which leads to wastage of space. to those particular buckets.
Rehashing
Rehashing is a collision resolution technique in which the table is resized,
i.e., the size of table is doubled by creating a new table.
Basically, when the load factor increases to more than its pre-
defined value (default value of load factor is 0.75), the
complexity increases.
So to overcome this, the size of the array is increased (doubled)
and all the values are hashed again and stored in the new double
sized array to maintain a low load factor and low complexity.
It is preferable is the total size of table is a prime number.
There are situations in which the rehashing is required:
When table is completely full
With quadratic probing when the table is filled half.
When insertions fail due to overflow.
Rehashing
How Rehashing is done?
Rehashing can be done as follows:
• For each addition of a new entry to the map, check the load
factor.
• If it’s greater than its pre-defined value (or default value of 0.75
if not given), then Rehash.
• For Rehash, make a new array of double the previous size and
make it the new bucket array.
• Then traverse to each element in the old bucket Array and call
the insert() for each so as to insert it into the new larger bucket
array.
Extensible/Extendible Hashing
The dynamic hashing method is used to overcome the problems
of static hashing like bucket overflow.
In this method, data buckets grow or shrink as the records
increases or decreases. This method is also known as
Extendable hashing method.

This method makes hashing dynamic, i.e.,insertion or


deletion without resulting performance.
How to search a key:
a) First, calculate the hash address of the key.
b)Check how many bits are used in the directory, and these bits are called as i.
c)Take the least significant i bits of the hash address. This gives an
index of the directory.
d)Now using the index, go to the directory and find bucket address where the
record might be.
Extensible/Extendible Hashing
How to insert a new record
Firstly, you have to follow thesame procedure for retrieval, ending up in
some bucket.
If there is still space in that bucket, then place the record in it.
If thebucket is full, then we will split thebucket and redistribute the
records.
For example :
Consider thefollowing grouping of keys depending on the prefix of their hash
address:
Extensible/Extendible Hashing
The last two bits of 2 and 4 are 00. So it will go into bucket B0. The
last two bits of 5 and 6 are 01, so it will go into bucket B1. The last
two bits of 1 and 3 are 10, so it will go into bucket B2. The last two
bits of 7 are 11, so it will go into B3.
Extensible/Extendible Hashing
Insert key 9 with hash address 10001 into the above structure:
1. Since key 9 has hash address 10001, it must go into the first bucket.
But bucket B1 is full, so it will get split.
2. The splitting will separate 5, 9 from 6 since last three bits of 5, 9 are
001, so it will go into bucket B1, and the last three bits of 6 are 101, so
it will go into bucket B5.
3. Keys 2 and 4 are still in B0. The record in B0 pointed by the 000 and

100 entry because last two bits of both the entry are 00.

4. Keys 1 and 3 are still in B2. The record in B2 pointed by the 010 and
110 entry because last two bits of both the entry are 10.
5. Key 7 are still in B3. The record in B3 pointed by the 111 and 011
entry because last two bits of both the entry are 11.
Extensible/Extendible Hashing
Advantages of Extensible Hashing
1. Inthis method, the performance does not decrease as the
data
grows in the system. It simply increases the size of memory to
accommodate the data.
2. In this method, memory is well utilized as it grows and shrinks
with the data. There will not be any unused memory lying.
3. This method is good for the dynamic database where data grows
and shrinks frequently
Disadvantages of ExtensibleHashing:
1. In this method, if the data size increases then the bucket size is
also increased.
2. In this case, the bucket overflow situation will also occur. But it
might take little time to reach this situation than static hashing
Skip List
A skip list is a probabilistic data structure.
The skip list is used to store a sorted list of elements or data with a linked list.
It allows the process of the elements or data to view efficiently. In one single
step, it skips several elements of the entire list, which is why it is known as a skip
list.
The skip list is an extended version of the linked list.
It allows the user to search, remove, and insert the element very quickly.
It consists of a base list that includes a set of elements which maintains the link
hierarchy of the subsequent elements.
Skip list structure:
It is built in two layers:
The lowest layer
Top layer.
The lowest layer of the skip list is a common sorted linked list
The top layers of the skip list are like an "express line" where the elements are
skipped
Skip List
Let's take an example to understand the working of the skip list. In this example, we have 14
nodes, such that these nodes are divided into two layers, as shown in the diagram.
The lower layer is a common line that links all nodes, and the top layer is an express line that links
only the main nodes, as you can see in the diagram.
Suppose you want to find 47 in this example. You will start the search from the first node of the
express line and continue running on the express line until you find a node that is equal a 47 or more
than 47.
You can see in the example that 47 does not exist in the express line, so you search for a node of less
than 47, which is 40. Now, you go to the normal line with the help of 40, and search the 47,
as shown in the diagram.
Skip List

Skip List Basic Operations:There are the following types of operations in the skip list.
1. Insertion operation: It is used to add a new node to a particular location in a specific
situation.
2. Deletion operation: It is used to delete a node in a specific situation.
3. Search Operation: The searchoperationis used to searcha particular node in a
skip list.
Example 1: Create a skip list, we want to insert these following keys in the empty
skip list.

Step 1: Insert 6 with level 1


1. 6 with level 1.

2. 29 with level 1.

3. 22 with level 4.

4. 9 with level 3.

5. 17 with level 1.

6. 4 with level 2.
Skip List
Example 1: Create a skip list, we want to insert these following
keys in the empty skip list.

Step 2: Insert 29 with level 1


1. 6 with level 1.
2. 29 with level 1.
3. 22 with level 4.
4. 9 with level 3.
5. 17 with level 1.
6. 4 with level 2.
Skip List
Example 1: Create a skip list, we want to insert these following
keys in the empty skip list.

Step 3: Insert 22 with level 4


1. 6 with level 1.
2. 29 with level 1.
3. 22 with level 4.
4. 9 with level 3.
5. 17 with level 1.
6. 4 with level 2.
Skip List
Example 1: Create a skip list, we want to insert these following
keys in the empty skip list.

Step 4: Insert 9 with level 3


1. 6 with level 1.
2. 29 with level 1.
3. 22 with level 4.
4. 9 with level 3.
5. 17 with level 1.
6. 4 with level 2.
Skip List
Example 1: Create a skip list, we want to insert these following
keys in the empty skip list.

Step 5: Insert 17 with level 1


1. 6 with level 1.
2. 29 with level 1.
3. 22 with level 4.
4. 9 with level 3.
5. 17 with level 1.
6. 4 with level 2.
Skip List
Example 1: Create a skip list, we want to insert these following
keys in the empty skip list.

Step 6: Insert 4 with level 2


1. 6 with level 1.
2. 29 with level 1.
3. 22 with level 4.
4. 9 with level 3.
5. 17 with level 1.
6. 4 with level 2.
Skip List
Example 2: Consider this example where we want to search for
key 17.
Skip List
Example 2: Consider this example where we want to search for
key 17.
Advantages of Skip List
1. If you want to insert a new node in the skip list, then it will insert the node very fast
because there are no rotations in the skip list.
2. The skip list is simple to implement as compared to the hash table and the binary
search tree.
3. It is very simple to find a node in the list because it stores the nodes in sorted form.
4. The skip list algorithm can be modified very easily in a more specific structure,
such as indexable skip lists, trees, or priority queues.
5. The skip list is a robust and reliable list.
Disadvantages of Skip List:

1. It requires more memory than the balanced tree.


2. Reverse searching is not allowed.
3. The skip list searches the node much slower than the linked list
Applications of Skip List
1. Skip list are used in distributed applications. In distributed
systems, the nodes of skip list represents the computer systems
and pointers represent network connection.
2. Skip list are used for implementing highly scalable concurrent
priority queues with less lock contention (struggle for having a
lock on a data item)
3. It is also used with the QMap template
Value-based template class that provides a dictionary)
4. The indexing of the skip list is used in running
problems.
5. skipdb is anopen-source database format using key/value pairs.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy