Hashing: Quadratic Probing sequence

Click For Summary
SUMMARY

The discussion focuses on generating a probing sequence using the quadratic probing technique for a hash table with a size of 19, starting with a hash value of h(K) = 9. The correct probing sequence derived includes values such as 9, 10, 8, 13, and 6, among others. A key point raised is the calculation of negative indices, specifically how to convert -7 into a valid index within the table size, which is resolved by adding the table size to the negative value. Participants suggest using LaTeX for clearer mathematical representation.

PREREQUISITES
  • Understanding of hashing techniques, specifically quadratic probing
  • Familiarity with modular arithmetic
  • Basic knowledge of hash tables and their operations
  • Ability to use LaTeX for mathematical notation
NEXT STEPS
  • Research "Quadratic Probing in Hash Tables" for deeper insights
  • Learn about "Modular Arithmetic" and its applications in hashing
  • Explore "LaTeX for Mathematical Typesetting" to improve clarity in mathematical expressions
  • Investigate "Collision Resolution Techniques" in hash tables beyond quadratic probing
USEFUL FOR

Students, computer science enthusiasts, and software developers interested in understanding hashing algorithms and collision resolution methods in data structures.

zak100
Messages
462
Reaction score
11

Homework Statement



Hi,
I want to generate probing sequence using quadratinc probing technique. If j =4 & table size = 19 & assuming h(K) = 9.

Homework Equations


h(K), h(K) + 1, h(k) -1, h(k) + 4, h(K) - 4, ... h(K) + (TSIZE -1)power 2 / 4, h(k) - (TSIZE -1) power 2 /4 all divided modulo TSize.

The Attempt at a Solution


The book shows following sequence:
9, 10, 8, 13, 5, 18, 0, 6, 12, 15, 3, 7, 11, 1, 17, 16, 2, 14, 4

I am able to find:
h(k) = 9%19 = 9
h(k) + 1 power 2 = 10 % 19 = 10
h(k) - 1 power 2 = 8 % 19 = 8
h(k) + 2 power 2 = 13 % 19 = 13
h(k) - 2 power 2 = 5 % 19 = 5
h(k) + 3 power 2 = 18 % 19 = 18
h(k) - 3 power 2 = 0
h(k) + 4 power 2 = 9 + 16 = 25 % 19 = 6
h(k) - 4 power 2 = 9 -16 = -7 %19 = -7 9 which is wrong,

Some body please guide me how to solve it.

Zulfi.
 
Physics news on Phys.org
I am editing this part. I can't find the edit option

The Attempt at a Solution


The book shows following sequence:
9, 10, 8, 13, 5, 18, 0, 6, 12, 15, 3, 7, 11, 1, 17, 16, 2, 14, 4

I am able to find:
h(k) = 9%19 = 9
h(k) + 1 power 2 = 10 % 19 = 10
h(k) - 1 power 2 = 8 % 19 = 8
h(k) + 2 power 2 = 13 % 19 = 13
h(k) - 2 power 2 = 5 % 19 = 5
h(k) + 3 power 2 = 18 % 19 = 18
h(k) - 3 power 2 = 0
h(k) + 4 power 2 = 9 + 16 = 25 % 19 = 6
h(k) - 4 power 2 = 9 -16 = -7 %19 = -7 which is wrong, it should be 12. I know 19 -7 = 12. But i don't know how to get it.

Some body please guide me how to solve it.

Zulfi.[/QUOTE]
 
zak100 said:
I am editing this part. I can't find the edit option

The Attempt at a Solution


The book shows following sequence:
9, 10, 8, 13, 5, 18, 0, 6, 12, 15, 3, 7, 11, 1, 17, 16, 2, 14, 4

I am able to find:
h(k) = 9%19 = 9
h(k) + 1 power 2 = 10 % 19 = 10
h(k) - 1 power 2 = 8 % 19 = 8
h(k) + 2 power 2 = 13 % 19 = 13
h(k) - 2 power 2 = 5 % 19 = 5
h(k) + 3 power 2 = 18 % 19 = 18
h(k) - 3 power 2 = 0
h(k) + 4 power 2 = 9 + 16 = 25 % 19 = 6
h(k) - 4 power 2 = 9 -16 = -7 %19 = -7 which is wrong, it should be 12. I know 19 -7 = 12. But i don't know how to get it.

Some body please guide me how to solve it.

Zulfi.
Have you seen this wikipedia article? https://en.wikipedia.org/wiki/Quadratic_probing
What is the complete problem statement? Are the numbers in your list the values in the hash table, or are they the things for which hash values need to be found?

Also, instead of writing "h(k) + 2 power 2" and so on, at the very least write this as h(k) + 2^2.

Even better, use LaTeX to write ##h(k) + 2^2##. My script for this is ##h(k) + 2^2##.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
2
Views
2K
  • · Replies 32 ·
2
Replies
32
Views
5K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
1K