notes

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit bd75e022744a3333ca8619bba33d018af0e2f984
parent 0ea5f66235997519a3953b018c6c0ca81e51bcec
Author: Andrew <andrewlaack1@gmail.com>
Date:   Thu, 17 Oct 2024 14:37:03 -0500

Fixed some notes

Diffstat:
MAlgorithms.md | 2++
MQuadraticProbing.md | 24+++++++++++++++++++-----
2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/Algorithms.md b/Algorithms.md @@ -71,6 +71,8 @@ Ch 5 (Hashing) - [ProbingFunction](ProbingFunction.md) - [QuadraticProbing](QuadraticProbing.md) - [LoadFactor](LoadFactor.md) + - Chaining + - BucketAddressing #### Other Stuff To Look At diff --git a/QuadraticProbing.md b/QuadraticProbing.md @@ -5,14 +5,28 @@ Ch 5 ## Notes -**Definition:** Quadratic probing is a probing strategy defined as follows: - -When i is odd: $f(e,i) = e + (ceil(i/2))^2$ - -When i is even: $f(e,i) = e - (ceil(i/2)^2$ +**Definition:** Quadratic probing is a probing strategy where we start with the input and then alternately move right and left by successive perfect squares. Basically, we check first e then e + 1 then then e - 1 then e + 4 then e - 4 and so on. Note: This only works with specific array sizes because some sizes don't get entirely mapped to by the probing function for all valid values of e. + +Implementation in code: + +```c# + +for(int i = 0 ; i < 10 ; ++i){ + int n = (i + 1) / 2; + if(i % 2 == 0){ + Console.WriteLine(n * -n); + } + else{ + Console.WriteLine(n * n); + } +} + +``` + +