Question 2(b)(i) 2017 · May-June · Paper 43 · 9 marks
Reveal official mark-scheme answer
Official answer for Question 2
Part (b)
(i)
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)
(i)
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.
(i)
The procedure, InsertRecord, takes as a parameter the customer record to be
inserted into the hash table.
The procedure makes use of the function Hash. Collisions will be managed using open hashing. This means a collision is resolved by storing the record in the next available location. The procedure will generate an error message if the hash table is full.
Question 5
Complete the pseudocode for the procedure.
PROCEDURE InsertRecord(BYVALUE NewCustomer : CustomerRecord)
TableFull FALSE
// generate hash value
Index ..................................................................................................................
Pointer Index // initialise Pointer variable to hash value
// find a free table element
WHILE ........................................................................................................................
Pointer .......................................................................................................
// wrap back to beginning of table if necessary
IF ........................................................................................................................
THEN
.................................................................................................................
ENDIF
// check if back to original index
IF ........................................................................................................................
THEN
TableFull TRUE
ENDIF
ENDWHILE
IF ..............................................................................................................................
THEN
........................................................................................................................
ELSE
........................................................................................................................
ENDIF
ENDPROCEDURE
Question 6
Why this question appears here
72% assigned-topic match · Programming › Constructs
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
