Generate pseudocode for searching for an Employee ID
I was given this example but I don't understand what it means
an employee ID (123) is hashed into a value of 5. For hDict(5) we store apointer to the first available spot in lValue, which at the time of the insertion was 2. We store a value of123 in lValue(2) and a value of null in lPtr(2) because there are no other elements right now, so weterminate the linked list. Later on another employee ID (135) needs to be inserted. It’s hash value isalso 5. In order to find where to insert it in lValue we need to traverse the linked list to get to the lastelement. The first element we come to is 2. lPtr(2) is null so we know we’re at the end of the linked list.So we get the next empty slot in lValue, which was 3, and assign the value 3 to lPtr(2). We assign thenew Employee ID (135) to next open slot lValue(3) and set lPtr(3) to null because it now becomes theend of the list.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here