QuadraticProbing.md (605B)
1 # Quadratic Probing 2 3 Ch 5 4 5 **Definition:** Quadratic probing is a probing strategy where we start with the input and then alternately move right and left by successive perfect squares. 6 7 Basically, we check first e then e + 1 then then e - 1 then e + 4 then e - 4 and so on. 8 9 Note: 10 11 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. 12 13 Implementation in code: 14 15 ```c# 16 17 for(int i = 0 ; i < 10 ; ++i){ 18 int n = (i + 1) / 2; 19 if(i % 2 == 0){ 20 Console.WriteLine(n * -n); 21 } 22 else{ 23 Console.WriteLine(n * n); 24 } 25 } 26 27 ``` 28