Question 2(b)(ii) 2017 · May-June · Paper 43 · 9 marks
Reveal official mark-scheme answer
Official answer for Question 2
Part (b)
(ii)
Question 9
Question 1
Question 1
Question 1
Question 1
Question 1
Question 1
Question 1
Question 1
Question 1
Show text version of question
Question 2
Part (b)
(ii)
Question 2
A hash table has these associated operations:
- create hash table
- insert record
- search hash table
Each record consists of a unique customer ID, the record key, and other customer data.
integer in the range 0 to 199 inclusive.
(ii)
The function SearchHashTable will search for a record in the hash table. The function
takes as a parameter the customer ID to be searched for. The function will return the position in the hash table where the record has been saved. If the hash table does not contain the record, the function will return the value −1.
You can assume that there is at least one empty record in the hash table.
Complete the pseudocode for the function.
FUNCTION SearchHashTable(BYVALUE SearchID : INTEGER) RETURNS INTEGER
// generate hash value
Index ..................................................................................................................
// check each record from index until found or not there
WHILE ( ....................................................................................................................)
AND (..................................................................................................................)
..............................................................................................................................
// wrap if necessary
IF ........................................................................................................................
THEN
.................................................................................................................
ENDIF
ENDWHILE
// has customer ID been found ?
IF ..............................................................................................................................
THEN
........................................................................................................................
ELSE
........................................................................................................................
ENDIF
ENDFUNCTION
Why this question appears here
72% assigned-topic match · Hardware › Logic gates and logic circuits
Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.
Permanent source page: Educate A Change · From 9608_s17_qp_43.pdf
