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 a pointer to...


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 a
pointer to the first available spot in lValue, which at the time of the insertion was 2. We store a value of
123 in lValue(2) and a value of null in lPtr(2) because there are no other elements right now, so we
terminate the linked list. Later on another employee ID (135) needs to be inserted. It’s hash value is
also 5. In order to find where to insert it in lValue we need to traverse the linked list to get to the last
element. 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 the
new Employee ID (135) to next open slot lValue(3) and set lPtr(3) to null because it now becomes the
end of the list.


Specifications:<br>Hash Dictionary – an array named hDict with a capacity of 12 elements. Each element stores a<br>pointer to IValue which will be the first element of the linked list for that has key.<br>• Value List – an array named IValue with a capacity of 1000 (assume 1000 employees max). Each<br>element stores a value that represents an Employee ID.<br>• Pointer List – an array named IPtr with a capacity of 100. Each element stores a pointer to the<br>next element in IValue that has the same hash key.<br>hDict<br>0 1<br>4 5 6 7 8 9<br>10<br>11<br>IValue<br>IPtr<br>2 4<br>4<br>5<br>7<br>8.<br>10<br>11<br>3,<br>2.<br>6,<br>

Extracted text: Specifications: Hash Dictionary – an array named hDict with a capacity of 12 elements. Each element stores a pointer to IValue which will be the first element of the linked list for that has key. • Value List – an array named IValue with a capacity of 1000 (assume 1000 employees max). Each element stores a value that represents an Employee ID. • Pointer List – an array named IPtr with a capacity of 100. Each element stores a pointer to the next element in IValue that has the same hash key. hDict 0 1 4 5 6 7 8 9 10 11 IValue IPtr 2 4 4 5 7 8. 10 11 3, 2. 6,
Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here