Hashing Lab 1. Given the following key values, show what the data structures would look like after insertions 27 53 13 10 138 109 49 174 26 24 (no preprocessing necessary: P= key) Linear and the linear-quotient collision path algorithm N= 13, 4k+3 prime = 19 of 10 elements using division hashing b. Bucket hashing of 10 elements (N=10) in = (P) % N а. array Array: Array: LOHashing: 1. ip = pk % N 2. q=pk/N if (q%N != 0) 1 1 3 3 4 4 offset = q 5 else 6 offset = 4k+3 prime
Hashing Lab 1. Given the following key values, show what the data structures would look like after insertions 27 53 13 10 138 109 49 174 26 24 (no preprocessing necessary: P= key) Linear and the linear-quotient collision path algorithm N= 13, 4k+3 prime = 19 of 10 elements using division hashing b. Bucket hashing of 10 elements (N=10) in = (P) % N а. array Array: Array: LOHashing: 1. ip = pk % N 2. q=pk/N if (q%N != 0) 1 1 3 3 4 4 offset = q 5 else 6 offset = 4k+3 prime
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
![# Hashing Lab
## Instructions
1. Given the following key values, show what the data structures would look like after insertions:
- Key values: 27, 53, 13, 10, 138, 109, 49, 174, 26, 24
- No preprocessing necessary: \(D_k = \text{key}\)
### a. Linear Array of 10 Elements
- **Using Division Hashing and the Linear-Quotient Collision Path Algorithm**
**Parameters:**
- \(N = 13\)
- \(4k+3 \text{ prime } = 19\)
**Algorithm:**
**LOHashing:**
1. \(i_p = D_k \% N\)
2. \(q = D_k / N\)
- If \((q \% N) \neq 0\), then
- \(\text{offset} = q\)
- Else
- \(\text{offset} = 4k+3 \text{ prime}\)
3. While collisions occur:
- \(i_p' = (i_p + \text{offset}) \% N\)
4. Set \(\text{Array}[i_p'] = \text{key}\)
**Array:**
```
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
```
### b. Bucket Hashing of 10 Elements (N=10)
- \(i_p = (D_k) \% N\)
**Array:**
```
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
```
### Explanation
- The diagram illustrates two types of hashing for storing the key values in arrays.
- **Array a:** Uses linear array hashing with a complex collision resolution strategy, combining division hashing and a calculated offset.
- **Array b:** Demonstrates simple bucket hashing where the](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fba28fbe0-fc04-46bc-bd01-9a9731588fb8%2F31d353d3-908f-49b1-9344-f73cbc55f782%2Fbvp33k_processed.png&w=3840&q=75)
Transcribed Image Text:# Hashing Lab
## Instructions
1. Given the following key values, show what the data structures would look like after insertions:
- Key values: 27, 53, 13, 10, 138, 109, 49, 174, 26, 24
- No preprocessing necessary: \(D_k = \text{key}\)
### a. Linear Array of 10 Elements
- **Using Division Hashing and the Linear-Quotient Collision Path Algorithm**
**Parameters:**
- \(N = 13\)
- \(4k+3 \text{ prime } = 19\)
**Algorithm:**
**LOHashing:**
1. \(i_p = D_k \% N\)
2. \(q = D_k / N\)
- If \((q \% N) \neq 0\), then
- \(\text{offset} = q\)
- Else
- \(\text{offset} = 4k+3 \text{ prime}\)
3. While collisions occur:
- \(i_p' = (i_p + \text{offset}) \% N\)
4. Set \(\text{Array}[i_p'] = \text{key}\)
**Array:**
```
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
```
### b. Bucket Hashing of 10 Elements (N=10)
- \(i_p = (D_k) \% N\)
**Array:**
```
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
```
### Explanation
- The diagram illustrates two types of hashing for storing the key values in arrays.
- **Array a:** Uses linear array hashing with a complex collision resolution strategy, combining division hashing and a calculated offset.
- **Array b:** Demonstrates simple bucket hashing where the

Transcribed Image Text:**Exercise 2: Complete the Table Based on Exercise 1**
The table below is designed to help you understand the number of comparisons required to retrieve elements from a data structure, based on a given key. This is part of an exercise focusing on hash tables and the differences between collision resolution strategies: linear probing and separate chaining with buckets.
**Number of Comparisons to Retrieve This Element**
| Key | Linear Array - (Length of Collision Path +1) | Buckets - (# of Elements in Linked List Compared) |
|-----|---------------------------------------------|--------------------------------------------------|
| 53 | | |
| 138 | | |
| 109 | | |
| 49 | | |
| 174 | | |
| 26 | | |
- *Linear Array Column*: Represents the number of comparisons needed using linear probing. This is calculated as the length of the collision path plus one.
- *Buckets Column*: Indicates the number of elements compared within a linked list when using separate chaining in hash tables.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images

Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY