using System;using System.Collections.Generic;using System.Text;namespace ReferralAssignment1Question1{ public class ReferralHashing { public struct Referral { //Define the variables public int value1; public string withLetter; public Referral(int a, string b, string c) { value1 = a; withLetter = b; } } //Input the hashing and probing formulas public int hashing(int n) { int position; position = n % 10; return position; } public int probe(int n) { int position; position = Math.Max(1, n / 10); return position; } public int wrap(int h, int p, int[] f) { int d; d = h - p; if (d < 0) { d = 10 + (h - p); } if (f[d] == 1) { d = d - p; d = wrap(d, p, f); } return d; } public static void Main(string[] args) { //Input the values to be processed int key = 0; int pos = 0; int h; int p; int[] flag = new int[10] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; int[] value1 = new int[7] { 1, 9, 18, 19, 5, 15, 25 }; string[] withLetter = new string[7] {"A1", "I9", "R18", "S19", "E5", "O15", "Y25"}; Referral[] bl = new Referral[10]; for (int i = 0; i < 10; i++) { bl[i] = new Referral(); } ReferralHashing blh = new ReferralHashing(); for (int i = 0; i < 7; i++) { key = value1[i]; h = blh.hashing(key); if (flag[h] == 1) { p = blh.probe(key); pos = blh.wrap(h, p, flag); } else { pos = h; } flag[pos] = 1; bl[pos].value1 = value1[i]; bl[pos].withLetter = withLetter[i]; //Display the results in the console Console.WriteLine(bl[pos].withLetter + "'s position in the table: " + pos); } } }}